{% import 'macros/actions.html' as actions_macros %} {% import 'macros/batch_actions.html' as batch_actions_macros %} {% macro get_list_page(configuration, pager) -%} {% if pager.get_nb_results() == 0 or pager.get_results() == None %}

{{ gettext('No result') }}

{% else %} {{ get_table(pager) }} {% if pager.have_to_paginate() %}{% set list_action_el =pager.get_list_action() %}{{ get_pager(pager=pager, page=page, url=list_action_el['url']) }}{% endif %} {% if pager.is_batch() %}{{ batch_actions_macros.batch_script(id='lw_admin_list_batch_checkbox', class='lw_admin_batch_checkbox') }}{% endif %} {% endif %} {%- endmacro %} {% macro get_table(pager) -%} {% set pk = pager.get_pk() %} {% set elements = pager.get_list_display() %} {% set cols = elements|count + 2 if pager.is_batch() else elements|count + 1 %} {% if pager.is_batch() %}{{ batch_actions_macros.batch_head_row(id='lw_admin_list_batch_checkbox') }}{% endif %} {% for element in elements %} {% endfor %} {% if pager.is_list_object_actions() %}{% endif %} {% for item in pager.get_results() %} {% if pager.is_batch() %} {{ batch_actions_macros.batch_body_row(class='lw_admin_batch_checkbox', value=item[pk])}} {% endif %} {% for element in elements %} {% endfor %} {% if pager.is_list_object_actions() %} {% endif %} {% endfor %}
{% if element['icon'] %}{% if not element['only_icon'] %} {% endif %}{% endif %}{% if element['label'] and not element['only_icon'] %}{{ element['label'] }}{% endif %} Actions
{{ get_footer(pager) }}
{% if element['type'] == 'bool' %}{% if item[element['key']] == True or item[element['key']] == 1 %}{% else %}{% endif %}{% else %}{{ item[element['key']] }}{% endif %}
{% for action_element in pager.get_list_object_actions(item) %} {% if action_element['visable'] == True %} {% if action_element['confirm'] == True %} {{ actions_macros.confirm_action(action_element=action_element) }} {% else %} {{ actions_macros.action(action_element=action_element) }} {% endif %} {% endif %} {% endfor %}
{%- endmacro %} {% macro get_pager(pager, page, url) -%} {%- endmacro %} {% macro get_footer(pager) -%} {% if pager.get_nb_results() == 0 %} {{ gettext('no result') }} {% else %} {{ ngettext('result: %(num)d', 'results: %(num)d', pager.get_nb_results())|format(num=pager.get_nb_results()) }} {% endif %} {% if pager.have_to_paginate() %} {{ gettext('page %(page)s/%(nb_pages)s', page=pager.get_page(), nb_pages=pager.get_last_page()) }} {% endif %} {%- endmacro %}