list.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. {% extends "misago/admin/generic/base.html" %}
  2. {% load i18n %}
  3. {% block title %}
  4. {{ active_link.name }} | {{ block.super }}
  5. {% endblock title%}
  6. {% block view %}
  7. {% if paginator or order_by or search_form or mass_actions %}
  8. <div class="table-actions">
  9. {% if paginator %}
  10. {% include "misago/admin/generic/paginator.html" %}
  11. {% endif%}
  12. {% if order_by %}
  13. <div class="btn-group pull-left">
  14. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
  15. {% trans "Sort:" %} <span class="fa fa-sort-numeric-{{ order.type }}"></span> <strong>{{ order.name }}</strong>
  16. </button>
  17. <ul class="dropdown-menu" role="menu">
  18. <li class="dropdown-title">
  19. {% trans "Change sorting to:" %}
  20. </li>
  21. {% for order in order_by %}
  22. <li>
  23. <form method="get">
  24. <input type="hidden" name="sort" value="{{ order.order_by }}">
  25. <input type="hidden" name="direction" value="{{ order.type }}">
  26. {% for name, value in query_filters.items %}
  27. <input type="hidden" name="{{ name }}" value="{{ value }}">
  28. {% endfor %}
  29. <button type="submit">
  30. <span class="fa fa-sort-numeric-{{ order.type }}"></span>
  31. {{ order.name }}
  32. </button>
  33. </form>
  34. </li>
  35. {% endfor %}
  36. </ul>
  37. </div>
  38. {% endif %}
  39. {% if search_form %}
  40. <button class="btn btn-{% if active_filters %}success{% else %}default{% endif %} pull-left" data-toggle="modal" data-target="#filter-modal">
  41. {% if active_filters %}
  42. <span class="fa fa-check"></span>
  43. {% trans "Change search" %}
  44. {% else %}
  45. <span class="fa fa-search"></span>
  46. {% trans "Search list" %}
  47. {% endif %}
  48. </button>
  49. {% if active_filters %}
  50. <form method="get" class="pull-left">
  51. <input type="hidden" name="clear_filters" value="1">
  52. {% for name, value in query_order.items %}
  53. <input type="hidden" name="{{ name }}" value="{{ value }}">
  54. {% endfor %}
  55. <button type="submit" class="btn btn-default">
  56. <span class="fa fa-times"></span>
  57. {% trans "Remove search" %}
  58. </button>
  59. </form>
  60. {% endif %}
  61. {% endif %}
  62. {% if mass_actions %}
  63. <button type="button" class="btn btn-default pull-right master-checkbox">
  64. <span class="fa fa-check"></span>
  65. </button>
  66. <div class="btn-group pull-right">
  67. <form id="mass-action" action="{{ querystring }}" method="post">
  68. <button type="button" class="btn btn-default dropdown-toggle mass-controller" data-toggle="dropdown">
  69. <span class="fa fa-gears"></span>
  70. {% trans "With selected" %}
  71. </button>
  72. {% csrf_token %}
  73. <ul class="dropdown-menu" role="menu">
  74. {% for action in mass_actions %}
  75. <li>
  76. <button type="submit" name="action" value="{{ action.action }}" {% if action.confirmation %}data-confirmation="{{ action.confirmation }}"{% endif %}>
  77. <span class="{{ action.icon }}"></span>
  78. {{ action.name }}
  79. </button>
  80. </li>
  81. {% endfor %}
  82. </ul>
  83. </form>
  84. </div>
  85. {% endif %}
  86. </div><!-- /.table-actions -->
  87. {% endif %}
  88. <div class="table-panel">
  89. <table class="table">
  90. <tr>
  91. {% block table-header %}
  92. {% endblock table-header %}
  93. {% if mass_actions %}
  94. <th class="width: 1%;">&nbsp;</th>
  95. {% endif %}
  96. </tr>
  97. {% block table-items %}
  98. {% for item in items %}
  99. <tr>
  100. {% block table-row %}{% endblock table-row %}
  101. {% if mass_actions %}
  102. <td class="row-select">
  103. <label>
  104. <input type="checkbox" form="mass-action" name="selected_items" value="{{ item.pk }}" {% if item.pk in selected_items %} checked{% endif %}>
  105. </label>
  106. </td>
  107. {% endif %}
  108. </tr>
  109. {% empty %}
  110. <tr class="message-row">
  111. {% block emptylist %}
  112. {% endblock emptylist %}
  113. </tr>
  114. {% endfor %}
  115. {% endblock table-items %}
  116. </table>
  117. </div><!-- /.table-panel -->
  118. {% if paginator %}
  119. <div class="table-actions">
  120. {% include "misago/admin/generic/paginator.html" %}
  121. </div><!-- /.table-actions -->
  122. {% endif %}
  123. {% endblock view %}
  124. {% block content %}
  125. {{ block.super }}
  126. {% if search_form %}
  127. <div class="modal fade" id="filter-modal" tabindex="-1" role="dialog" aria-labelledby="filter-modal-label" aria-hidden="true">
  128. <div class="modal-dialog">
  129. <div class="modal-content">
  130. <div class="modal-header">
  131. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  132. <h4 class="modal-title" id="filter-modal-label">
  133. {% block modal-title %}
  134. {% endblock modal-title %}
  135. </h4>
  136. </div>
  137. <form method="GET">
  138. <input type="hidden" name="set_filters" value="1">
  139. {% for name, value in query_order.items %}
  140. <input type="hidden" name="{{ name }}" value="{{ value }}">
  141. {% endfor %}
  142. <div class="modal-body">
  143. {% block modal-body %}
  144. {% endblock modal-body %}
  145. </div>
  146. <div class="modal-footer">
  147. {% block modal-footer %}
  148. <button type="button" class="btn btn-default" data-dismiss="modal">
  149. {% trans "Close" %}
  150. </button>
  151. <button type="submit" class="btn btn-primary">
  152. {% trans "Save changes" %}
  153. </button>
  154. {% endblock modal-footer %}
  155. </div>
  156. </form>
  157. </div>
  158. </div>
  159. </div>
  160. {% endif %}
  161. {% endblock content%}
  162. {% block javascripts %}
  163. {% if mass_actions %}
  164. <script type="text/javascript">
  165. $(function() {
  166. tableMassActions("{{ empty_selection_label }}", "{{ selection_label }}");
  167. });
  168. </script>
  169. {% endif %}
  170. {% endblock javascripts %}