Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / templates / im / table_render.html @ 2743e261

History | View | Annotate | Download (3.2 kB)

1
{% spaceless %}
2
{% load django_tables2 %}
3
{% load i18n %}
4
{% if table.page %}
5
<div class="table-container">
6
{% endif %}
7
{% block table %}
8
<table{% if  %} {{ table.attrs.as_html }}{% endif %}>
9
    {% if table.attrs.caption %}
10
    <caption>{{ table.attrs.caption }}</caption>
11
    {% endif %}
12
    {% nospaceless %}
13
    {% block table.thead %}
14
    <thead>
15
        <tr>
16
        {% for column in table.columns %}
17
            {% if column.orderable %}
18
            <th {{ column.attrs.th.as_html }}><a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}#{{ table.attrs.id }}">{{ column.header }}</a></th>
19
            {% else %}
20
            <th {{ column.attrs.th.as_html }}>{{ column.header }}</th>
21
            {% endif %}
22
        {% endfor %}
23
        </tr>
24
    </thead>
25
    {% endblock table.thead %}
26
    {% block table.tbody %}
27
    <tbody>
28
        {% for row in table.page.object_list|default:table.rows %} {# support pagination #}
29
        {% block table.tbody.row %}
30
        <tr class="{% cycle "odd" "even" %}">
31
            {% for column, cell in row.items %}
32
                <td {{ column.attrs.td.as_html }}>{{ cell }}</td>
33
            {% endfor %}
34
        </tr>
35
        {% endblock table.tbody.row %}
36
        {% empty %}
37
        {% if table.empty_text %}
38
        {% block table.tbody.empty_text %}
39
        <tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
40
        {% endblock table.tbody.empty_text %}
41
        {% endif %}
42
        {% endfor %}
43
    </tbody>
44
    {% endblock table.tbody %}
45
    {% block table.tfoot %}
46
    <tfoot></tfoot>
47
    {% endblock table.tfoot %}
48
    {% endnospaceless %}
49
</table>
50
{% endblock table %}
51

    
52
{% if table.page %}
53
{% with table.page.paginator.count as total %}
54
{% with table.page.object_list|length as count %}
55
{% block pagination %}
56
<ul class="pagination">
57
    {% if table.page.has_previous %}
58
    {% nospaceless %}{% block pagination.previous %}<li class="previous"><a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}#{{ table.attrs.id }}">{% trans "Previous" %}</a></li>{% endblock pagination.previous %}{% endnospaceless %}
59
    {% endif %}
60

    
61
    {% if table.page.has_previous or table.page.has_next %}
62
    {% nospaceless %}{% block pagination.current %}<li class="current">{% blocktrans with table.page.number as current and table.paginator.num_pages as total %}Page {{ current }} of {{ total }}{% endblocktrans %}</li>{% endblock pagination.current %}{% endnospaceless %}
63
    {% endif %}
64

    
65
    {% if table.page.has_next %}
66
    {% nospaceless %}{% block pagination.next %}<li class="next"><a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}#{{ table.attrs.id }}">{% trans "Next" %}</a></li>{% endblock pagination.next %}{% endnospaceless %}
67
    {% endif %}
68

    
69
    {% nospaceless %}{% block pagination.cardinality %}<li class="cardinality">{% if total != count %}{% blocktrans %}{{ count }} of {{ total }}{% endblocktrans %}{% else %}{{ total }}{% endif %} {% if total == 1 %}{{ table.data.verbose_name }}{% else %}{{ table.data.verbose_name_plural }}{% endif %}</li>{% endblock pagination.cardinality %}{% endnospaceless %}
70
</ul>
71
{% endblock pagination %}
72
{% endwith %}
73
{% endwith %}
74
</div>
75
{% endif %}
76
{% endspaceless %}