summaryrefslogtreecommitdiff
path: root/horizon/templates/horizon/common/_data_table.html
blob: 9713752f5c7b7a7c7d1aa57472214faa11c5d018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{% load i18n %}
{% with table.needs_form_wrapper as needs_form_wrapper %}
<div class="table_wrapper">
  {% if needs_form_wrapper %}<form action="{{ table.get_absolute_url }}" method="POST">{% csrf_token %}{% endif %}
  {% with columns=table.get_columns rows=table.get_rows %}
  <table id="{{ table.name }}" class="table table-bordered table-striped">
    <thead>
      <tr class='table_caption'>
        <th class='table_header' colspan='{{ columns|length }}'>
          <h3 class='table_title'>{{ table }}</h3>
          {{ table.render_table_actions }}
        </th>
      </tr>
      {% if not table.is_browser_table %}
      <tr>
        {% for column in columns %}
          <th {{ column.attr_string|safe }}>{{ column }}</th>
        {% endfor %}
      </tr>
      {% endif %}
    </thead>
    <tbody>
    {% for row in rows %}
      {{ row.render }}
    {% empty %}
    <tr class="{% cycle 'odd' 'even' %} empty">
      <td colspan="{{ table.get_columns|length }}">{{ table.get_empty_message }}</td>
    </tr>
    {% endfor %}
    </tbody>
    <tfoot>
      {% if table.needs_summary_row %}
      <tr class="summation">
        {% for column in columns %}
          {% if forloop.first %}
          <td>{% trans "Summary" %}</td>
          {% else %}
          <td>{{ column.get_summation|default:"&ndash;"}}</td>
          {% endif %}
        {% endfor %}
      </tr>
      {% endif %}
      <tr>
        <td colspan="{{ table.get_columns|length }}">
          <span>{% blocktrans count counter=rows|length %}Displaying {{ counter }} item{% plural %}Displaying {{ counter }} items{% endblocktrans %}</span>
          {% if table.has_more_data %}
          <span class="spacer">|</span>
          <a href="?{{ table.get_pagination_string }}">More&nbsp;&raquo;</a>
          {% endif %}
        </td>
      </td>
    </tfoot>
  </table>
  {% endwith %}
  {% if needs_form_wrapper %}</form>{% endif %}
</div>
{% endwith %}