list.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. {% extends "misago/admin/generic/list.html" %}
  2. {% load i18n misago_admin_form misago_capture %}
  3. {% block page-actions %}
  4. <div class="col-auto page-action">
  5. <a href="{% url 'misago:admin:users:agreements:new' %}" class="btn btn-primary">
  6. <span class="fa fa-plus-circle"></span>
  7. {% trans "New agreement" %}
  8. </a>
  9. </div>
  10. {% endblock %}
  11. {% block table-header %}
  12. <th style="width: 1%;">&nbsp;</th>
  13. <th>{% trans "Agreement" %}</th>
  14. <th style="width: 1%;">&nbsp;</th>
  15. <th style="width: 180px;">{% trans "Type" %}</th>
  16. <th style="width: 250px;">{% trans "Created" %}</th>
  17. <th style="width: 250px;">{% trans "Modified" %}</th>
  18. <th style="width: 1%;">&nbsp;</th>
  19. <th style="width: 1%;">&nbsp;</th>
  20. <th style="width: 1%;">&nbsp;</th>
  21. {% endblock table-header %}
  22. {% block table-row %}
  23. <td class="pr-0">
  24. {% if item.is_active %}
  25. <a href="{{ item.get_absolute_url }}" class="btn btn-light btn-sm">
  26. <span class="fas fa-external-link-alt"></span>
  27. </a>
  28. {% endif %}
  29. </td>
  30. <td class="pr-0 small">
  31. <a href="{% url 'misago:admin:users:agreements:edit' pk=item.pk %}" class="item-name">
  32. {{ item.get_final_title }}
  33. </a>
  34. </td>
  35. <td class="badges-list">
  36. {% if item.is_active %}
  37. <span class="badge badge-success">
  38. {% trans "Active" %}
  39. </span>
  40. {% endif %}
  41. </td>
  42. <td class="small">
  43. {{ item.get_type_display }}
  44. </td>
  45. <td class="small">
  46. {% capture trimmed as created_on %}
  47. <abbr data-timestamp="{{ item.created_on.isoformat }}" data-format="LL"></abbr>
  48. {% endcapture %}
  49. {% capture trimmed as created_by %}
  50. {% if item.created_by %}
  51. <a href="{{ item.created_by.get_absolute_url }}" class="item-title">{{ item.created_by }}</a>
  52. {% else %}
  53. <span class="item-title">{{ item.created_by_name }}</span>
  54. {% endif %}
  55. {% endcapture %}
  56. {% blocktrans trimmed with created_on=created_on|safe created_by=created_by|safe %}
  57. {{ created_on }} by {{ created_by }}
  58. {% endblocktrans %}
  59. </td>
  60. <td class="small">
  61. {% if item.last_modified_on %}
  62. {% capture trimmed as last_modified_on %}
  63. <abbr data-timestamp="{{ item.last_modified_on.isoformat }}" data-format="LL">
  64. {{ item.last_modified_on }}
  65. </abbr>
  66. {% endcapture %}
  67. {% capture trimmed as last_modified_by %}
  68. {% if item.last_modified_by %}
  69. <a href="{{ item.last_modified_by.get_absolute_url }}" class="item-title">{{ item.last_modified_by }}</a>
  70. {% else %}
  71. <span class="item-title">{{ item.last_modified_by }}</span>
  72. {% endif %}
  73. {% endcapture %}
  74. {% blocktrans trimmed with last_modified_on=last_modified_on|safe last_modified_by=last_modified_by|safe %}
  75. {{ last_modified_on }} by {{ last_modified_by }}
  76. {% endblocktrans %}
  77. {% else %}
  78. <em>{% trans "never" %}</em>
  79. {% endif %}
  80. </td>
  81. <td>
  82. {% if not item.is_active %}
  83. <form action="{% url 'misago:admin:users:agreements:set-as-active' pk=item.pk %}" method="post" class="set-as-active-prompt">
  84. <button class="btn btn-primary" data-tooltip="top" title="{% trans 'Set as active' %}">
  85. {% csrf_token %}
  86. <span class="fa fa-check-square"></span>
  87. </button>
  88. </form>
  89. {% else %}
  90. &nbsp;
  91. {% endif %}
  92. </td>
  93. <td>
  94. <a href="{% url 'misago:admin:users:agreements:edit' pk=item.pk %}" class="btn btn-light btn-sm">
  95. {% trans "Edit" %}
  96. </a>
  97. </td>
  98. <td>
  99. <form action="{% url 'misago:admin:users:agreements:delete' pk=item.pk %}" method="post" class="delete-prompt">
  100. {% csrf_token %}
  101. <button class="btn btn-light btn-sm">
  102. {% trans "Remove" %}
  103. </button>
  104. </form>
  105. </td>
  106. {% endblock %}
  107. {% block blankslate %}
  108. <td colspan="10">
  109. {% if active_filters %}
  110. {% trans "No agreements matching criteria exist." %}
  111. {% else %}
  112. {% trans "No agreements are set." %}
  113. {% endif %}
  114. </td>
  115. {% endblock blankslate %}
  116. {% block javascripts %}
  117. {{ block.super }}
  118. <script type="text/javascript">
  119. $(function() {
  120. $('.set-as-active-prompt').submit(function() {
  121. var decision = confirm("{% trans 'Are you sure you want to set this agreement as active for its type?' %}");
  122. return decision;
  123. });
  124. $('.delete-prompt').submit(function() {
  125. var decision = confirm("{% trans 'Are you sure you want to delete this agreement?' %}");
  126. return decision;
  127. });
  128. });
  129. </script>
  130. {% endblock %}
  131. {% block filters-modal-body %}
  132. <div class="row">
  133. <div class="col">
  134. {% form_row filter_form.type %}
  135. </div>
  136. </div>
  137. <div class="row">
  138. <div class="col">
  139. {% form_row filter_form.content %}
  140. </div>
  141. </div>
  142. {% endblock filters-modal-body %}