1
0
mirror of https://github.com/Yubico/yubiadmin.git synced 2025-03-15 20:29:16 +01:00
2013-05-24 12:43:29 +02:00

64 lines
1.7 KiB
HTML

{% macro header(cols, next=None, prev=None, shown=0, total=0, item_name='Items', selectable=True) %}
<thead>
<tr>
{% if selectable %}
{% set width = 95 %}
<th style="width: 5%">
<input type="checkbox" id="toggle_all" />
</th>
{% else %}
{% set width = 100 %}
{% endif %}
{% for col in cols %}
<th style="width: 15%">
{{ col }}
</th>
{% endfor %}
{% set col_len = cols|length %}
<th style="width: {{ width - col_len * 15 }}%; text-align:right;">
{{ item_name }} {{ shown }} of {{ total }}
&nbsp;
<div class="btn-group">
{% if prev %}
<a class="btn btn-small" href="{{ prev }}">Prev</a>
{% else %}
<a class="btn btn-small disabled">Prev</a>
{% endif %}
{% if next %}
<a class="btn btn-small" href="{{ next }}">Next</a>
{% else %}
<a class="btn btn-small disabled">Next</a>
{% endif %}
</div>
</th>
</tr>
</thead>
{% endmacro %}
{% macro body(cols, items, selectable=True) %}
<tbody>
{% for item in items %}
<tr>
{% if selectable %}
<td><input type="checkbox" name="item/{{ item.id }}"/></td>
{% endif %}
{% for col in cols %}
<td{% if loop.last %} colspan="2"{% endif %}>{{ item[col] }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
{% endmacro %}
{% macro table(cols, items, caption=None, next=None, prev=None, shown=0, total=0, item_name='Items', selectable=True) %}
<table class="table table-striped table-condensed">
{% if caption %}
<caption>{{ caption }}</caption>
{% endif %}
{{ header(cols, next, prev, shown, total, item_name, selectable) }}
{{ body(cols, items, selectable) }}
</table>
{% endmacro %}
{{ table(cols, items, caption, next, prev, shown, total, item_name, selectable) }}