@@ -429,29 +429,37 @@
|
||||
<table class="table js_kanban">
|
||||
<thead>
|
||||
<tr>
|
||||
<t t-set="width" t-value="str(round(100.0 / len(objects), 2)) + '%'"/>
|
||||
<t t-foreach="objects">
|
||||
<t t-set="width" t-valuef="{{ round(100.0 / len(objects), 2) }}%"/>
|
||||
<t t-foreach="objects" t-as="obj">
|
||||
<th t-att-width="width">
|
||||
<div t-field="column_id.name" class="text-center"></div>
|
||||
<div t-field="obj['column_id'].name" class="text-center"></div>
|
||||
</th>
|
||||
</t>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<t t-foreach="objects">
|
||||
<td class="js_kanban_col" t-att-data-template="template" t-att-data-domain="domain" t-att-data-page_count="page_count" t-att-data-model="model" t-att-data-step="step" t-att-data-orderby="orderby">
|
||||
<t t-foreach="object_ids" t-as="object_id">
|
||||
<t t-foreach="objects" t-as="obj">
|
||||
<td class="js_kanban_col" t-att-data-template="template"
|
||||
t-att-data-domain="obj['domain']"
|
||||
t-att-data-page_count="obj['page_count']"
|
||||
t-att-data-model="obj['model']"
|
||||
t-att-data-step="obj['step']"
|
||||
t-att-data-orderby="obj['orderby']">
|
||||
<t t-foreach="obj['object_ids']" t-as="object_id">
|
||||
<t t-call="#{ template }"></t>
|
||||
</t>
|
||||
<!-- pager -->
|
||||
<div t-if="1 != page_end" class="pagination pagination-centered">
|
||||
<div t-if="1 != obj['page_end']" class="pagination pagination-centered">
|
||||
<ul>
|
||||
<li t-attf-class="prev #{'active' if page == 1 else '' }"> <a t-att-href=" '%s,%s-%s' % (kanban_url, column_id.id, (page > 1 and page-1 or 1)) ">Prev</a></li>
|
||||
<t t-foreach="range(page_start, page_end+1)" t-as="p">
|
||||
<li t-att-class=" 'active' if page == p else '' "> <a t-att-href=" '%s,%s-%s' % (kanban_url, column_id.id, p)" t-esc="p"></a></li>
|
||||
<li t-attf-class="prev #{'active' if obj['page'] == 1 else '' }">
|
||||
<a t-att-href=" '%s,%s-%s' % (obj['kanban_url'], obj['column_id'].id, (obj['page'] > 1 and obj['page']-1 or 1)) ">Prev</a></li>
|
||||
<t t-foreach="range(obj['page_start'], obj['page_end']+1)" t-as="p">
|
||||
<li t-att-class=" 'active' if obj['page'] == p else '' ">
|
||||
<a t-att-href=" '%s,%s-%s' % (obj['kanban_url'], obj['column_id'].id, p)" t-esc="p"></a></li>
|
||||
</t>
|
||||
<li t-attf-class="next #{'active' if page == page_end else '' }"> <a t-att-href=" '%s,%s-%s' % (kanban_url, column_id.id, (page < page_end and page+1 or page_end) )">Next</a></li>
|
||||
<li t-attf-class="next #{'active' if obj['page'] == obj['page_end'] else '' }">
|
||||
<a t-att-href=" '%s,%s-%s' % (obj['kanban_url'], obj['column_id'].id, (obj['page'] < obj['page_end'] and obj['page']+1 or obj['page_end']) )">Next</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -162,10 +162,11 @@
|
||||
<template id="event_category" inherit_id="website_event.event_left_column" optional="disabled" name="Filter by Category">
|
||||
<xpath expr="//div[@id='left_column']" position="inside">
|
||||
<ul class="nav nav-pills nav-stacked mt32">
|
||||
<t t-foreach="types">
|
||||
<li t-if="type" t-att-class="searches.get('type') == str(type and type[0]) and 'active' or ''">
|
||||
<a t-attf-href="/event?{{ keep_query('country', 'date', type=type[0]) }}"><t t-esc="type[1]"/>
|
||||
<span class="badge pull-right"><t t-esc="type_count"/></span>
|
||||
<t t-foreach="types" t-as="type">
|
||||
<li t-if="type['type']"
|
||||
t-att-class="searches.get('type') == str(type['type'] and type['type'][0]) and 'active' or ''">
|
||||
<a t-attf-href="/event?{{ keep_query('country', 'date', type=type['type'][0]) }}"><t t-esc="type['type'][1]"/>
|
||||
<span class="badge pull-right"><t t-esc="type['type_count']"/></span>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
@@ -176,10 +177,10 @@
|
||||
<template id="event_location" inherit_id="website_event.event_left_column" optional="disabled" name="Filter by Country">
|
||||
<xpath expr="//div[@id='left_column']" position="inside">
|
||||
<ul class="nav nav-pills nav-stacked mt32">
|
||||
<t t-foreach="countries">
|
||||
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id and country_id[0]) and 'active' or ''">
|
||||
<a t-attf-href="/event?{{ keep_query('type', 'data', country=country_id[0]) }}"><t t-esc="country_id[1]"/>
|
||||
<span class="badge pull-right"><t t-esc="country_id_count"/></span>
|
||||
<t t-foreach="countries" t-as="country">
|
||||
<li t-if="country['country_id']" t-att-class="searches.get('country') == str(country['country_id'] and country['country_id'][0]) and 'active' or ''">
|
||||
<a t-attf-href="/event?{{ keep_query('type', 'data', country=country['country_id'][0]) }}"><t t-esc="country['country_id'][1]"/>
|
||||
<span class="badge pull-right"><t t-esc="country['country_id_count']"/></span>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
|
||||
@@ -88,10 +88,10 @@
|
||||
<xpath expr="//div[@id='left_column']/ul[1]" position="after">
|
||||
<ul class="nav nav-pills nav-stacked mt16">
|
||||
<li class="nav-header"><h3>Location</h3></li>
|
||||
<t t-foreach="countries">
|
||||
<li t-if="country_id" t-att-class="country_id[0] == current_country_id and 'active' or ''">
|
||||
<a t-attf-href="/members#{ membership and '/association/%s' % membership.id or '' }#{ country_id[0] and '/country/%s' % slug(country_id) or '' }#{ search }"><t t-esc="country_id[1]"/>
|
||||
<span class="badge pull-right"><t t-esc="country_id_count or '0'"/></span>
|
||||
<t t-foreach="countries" t-as="country">
|
||||
<li t-if="country['country_id']" t-att-class="country['country_id'][0] == current_country_id and 'active' or ''">
|
||||
<a t-attf-href="/members#{ membership and '/association/%s' % membership.id or '' }#{ country['country_id'][0] and '/country/%s' % slug(country['country_id']) or '' }#{ search }"><t t-esc="country['country_id'][1]"/>
|
||||
<span class="badge pull-right"><t t-esc="country['country_id_count'] or '0'"/></span>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
|
||||
@@ -354,40 +354,41 @@ class QWeb(orm.AbstractModel):
|
||||
def render_tag_foreach(self, element, template_attributes, generated_attributes, qwebcontext):
|
||||
expr = template_attributes["foreach"]
|
||||
enum = self.eval_object(expr, qwebcontext)
|
||||
if enum is not None:
|
||||
var = template_attributes.get('as', expr).replace('.', '_')
|
||||
copy_qwebcontext = qwebcontext.copy()
|
||||
size = -1
|
||||
if isinstance(enum, (list, tuple)):
|
||||
size = len(enum)
|
||||
elif hasattr(enum, 'count'):
|
||||
size = enum.count()
|
||||
copy_qwebcontext["%s_size" % var] = size
|
||||
copy_qwebcontext["%s_all" % var] = enum
|
||||
index = 0
|
||||
ru = []
|
||||
for i in enum:
|
||||
copy_qwebcontext["%s_value" % var] = i
|
||||
copy_qwebcontext["%s_index" % var] = index
|
||||
copy_qwebcontext["%s_first" % var] = index == 0
|
||||
copy_qwebcontext["%s_even" % var] = index % 2
|
||||
copy_qwebcontext["%s_odd" % var] = (index + 1) % 2
|
||||
copy_qwebcontext["%s_last" % var] = index + 1 == size
|
||||
if index % 2:
|
||||
copy_qwebcontext["%s_parity" % var] = 'odd'
|
||||
else:
|
||||
copy_qwebcontext["%s_parity" % var] = 'even'
|
||||
if 'as' in template_attributes:
|
||||
copy_qwebcontext[var] = i
|
||||
elif isinstance(i, dict):
|
||||
copy_qwebcontext.update(i)
|
||||
ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext))
|
||||
index += 1
|
||||
return "".join(ru)
|
||||
else:
|
||||
if enum is None:
|
||||
template = qwebcontext.get('__template__')
|
||||
raise QWebException("foreach enumerator %r is not defined while rendering template %r" % (expr, template), template=template)
|
||||
|
||||
varname = template_attributes['as'].replace('.', '_')
|
||||
copy_qwebcontext = qwebcontext.copy()
|
||||
size = -1
|
||||
if isinstance(enum, collections.Sized):
|
||||
size = len(enum)
|
||||
copy_qwebcontext["%s_size" % varname] = size
|
||||
copy_qwebcontext["%s_all" % varname] = enum
|
||||
ru = []
|
||||
for index, item in enumerate(enum):
|
||||
copy_qwebcontext.update({
|
||||
varname: item,
|
||||
'%s_value' % varname: item,
|
||||
'%s_index' % varname: index,
|
||||
'%s_first' % varname: index == 0,
|
||||
'%s_last' % varname: index + 1 == size,
|
||||
})
|
||||
if index % 2:
|
||||
copy_qwebcontext.update({
|
||||
'%s_parity' % varname: 'odd',
|
||||
'%s_even' % varname: False,
|
||||
'%s_odd' % varname: True,
|
||||
})
|
||||
else:
|
||||
copy_qwebcontext.update({
|
||||
'%s_parity' % varname: 'even',
|
||||
'%s_even' % varname: True,
|
||||
'%s_odd' % varname: False,
|
||||
})
|
||||
ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext))
|
||||
return "".join(ru)
|
||||
|
||||
def render_tag_if(self, element, template_attributes, generated_attributes, qwebcontext):
|
||||
if self.eval_bool(template_attributes["if"], qwebcontext):
|
||||
return self.render_element(element, template_attributes, generated_attributes, qwebcontext)
|
||||
|
||||
Reference in New Issue
Block a user