Merge branch 'bug/13869_disk_defaults' into release/0.10.1
[ganeti_webmgr.git] / ganeti_web / templates / table_base.html
blob0d9d24ce58c9aa1aaa8ab54a2b3ffbf99b0a8cf6
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 %} {{ table.attrs.as_html }}{% endif %}>
9 {% nospaceless %}
10 {% block table.thead %}
11 <thead>
12 <tr>
13 {% for column in table.columns %}
14 {% if column.header == "Status" %}
15 <th {{ column.attrs.th.as_html }}>
16 {% if column.orderable %}
17 <a href="{{ ajax_url }}{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}"></a>
18 {% endif %}
19 </th>
20 {% elif column.orderable %}
21 <th {{ column.attrs.th.as_html }}><a href="{{ ajax_url }}{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header }}</a></th>
22 {% else %}
23 <th {{ column.attrs.th.as_html }}>{{ column.header }}</th>
24 {% endif %}
25 {% endfor %}
26 </tr>
27 </thead>
28 {% endblock table.thead %}
29 {% block table.tbody %}
30 <tbody>
31 {% for row in table.page.object_list|default:table.rows %} {# support pagination #}
32 {% block table.tbody.row %}
33 <tr class="{% cycle "odd" "even" %}">
34 {% for column, cell in row.items %}
35 <td {{ column.attrs.td.as_html }}>{{ cell }}</td>
36 {% endfor %}
37 </tr>
38 {% endblock table.tbody.row %}
39 {% empty %}
40 {% if table.empty_text %}
41 {% block table.tbody.empty_text %}
42 <tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
43 {% endblock table.tbody.empty_text %}
44 {% endif %}
45 {% endfor %}
46 </tbody>
47 {% endblock table.tbody %}
48 {% block table.tfoot %}
49 <tfoot></tfoot>
50 {% endblock table.tfoot %}
51 {% endnospaceless %}
52 </table>
53 {% endblock table %}
55 {% if table.page %}
56 {% with table.page.paginator.count as total %}
57 {% with table.page.object_list|length as count %}
58 {% block pagination %}
59 <ul class="pagination">
60 {% if table.page.has_previous %}
61 {% nospaceless %}{% block pagination.previous %}<li class="previous"><a href="{{ ajax_url }}{% querystring table.prefixed_page_field=table.page.previous_page_number %}">{% trans "Previous" %}</a></li>{% endblock pagination.previous %}{% endnospaceless %}
62 {% endif %}
64 {% if table.page.has_previous or table.page.has_next %}
65 {% 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 %}
66 {% endif %}
68 {% if table.page.has_next %}
69 {% nospaceless %}{% block pagination.next %}<li class="next"><a href="{{ ajax_url }}{% querystring table.prefixed_page_field=table.page.next_page_number %}">{% trans "Next" %}</a></li>{% endblock pagination.next %}{% endnospaceless %}
70 {% endif %}
72 {% 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 %}
73 </ul>
74 {% endblock pagination %}
75 {% endwith %}
76 {% endwith %}
77 </div>
78 {% endif %}
79 {% endspaceless %}