list.html 6.8 KB

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