浏览代码

Update list submission template to match new wagtail update template (#666)

The `wagtailforms/list_submissions.html` template is customized to
use/respect protected media. This was changed in Wagtail 6.1, but was
not updated to match in the CRX, causing pagination to fail to appear.
Jeremy Childers 1 月之前
父节点
当前提交
66ab5e92fb
共有 1 个文件被更改,包括 46 次插入36 次删除
  1. 46 36
      coderedcms/templates/wagtailforms/list_submissions.html

+ 46 - 36
coderedcms/templates/wagtailforms/list_submissions.html

@@ -1,39 +1,49 @@
-{% load i18n coderedcms_tags %}
-
-<div class="overflow">
-    <table class="listing">
-        <col />
-        <col />
-        <col />
-        <thead>
-            <tr>
-                <th colspan="{{ data_headings|length|add:1 }}">
-                    <button class="button no" id="delete-submissions" style="visibility: hidden">{% trans "Delete selected submissions" %}</button>
-                </th>
-            </tr>
-            <tr>
-                <th><input type="checkbox" id="select-all" /></th>
-                {% for heading in data_headings %}
-                    <th id="{{ heading.name }}" class="{% if heading.order %}ordered {{ heading.order }}{% endif %}">
-                      {% if heading.order %}<a href="?order_by={% if heading.order == 'ascending' %}-{% endif %}{{ heading.name }}">{{ heading.label }}</a>{% else %}{{ heading.label }}{% endif %}
-                    </th>
-                {% endfor %}
-            </tr>
-        </thead>
-        <tbody>
-            {% for row in data_rows %}
+{% extends "wagtailadmin/generic/listing_results.html" %}
+{% load i18n l10n coderedcms_tags %}
+{% block results %}
+    <form class="w-overflow-auto" data-controller="w-bulk" data-w-bulk-action-inactive-class="w-invisible" action="{% url 'wagtailforms:delete_submissions' form_page.id %}" method="get">
+        <input type="hidden" value="{{ next_url }}" name="next">
+        <table class="listing">
+            <col />
+            <col />
+            <col />
+            <thead>
                 <tr>
-                    <td>
-                        <input type="checkbox" name="selected-submissions" class="select-submission" value="{{ row.model_id }}" />
-                    </td>
-                    {% for cell in row.fields %}
-                        <td>
-                            {% process_form_cell request cell %}
-                        </td>
+                    <th><input type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" /></th>
+                    {% for heading in data_headings %}
+                        <th id="{{ heading.name }}" class="{% if heading.order %}ordered icon {% if heading.order == 'ascending' %}icon-arrow-up-after{% else %}icon-arrow-down-after{% endif %}{% endif %}">
+                            {% if heading.order %}<a href="?order_by={% if heading.order == 'ascending' %}-{% endif %}{{ heading.name }}">{{ heading.label }}</a>{% else %}{{ heading.label }}{% endif %}
+                        </th>
                     {% endfor %}
-                    <td>
                 </tr>
-            {% endfor %}
-        </tbody>
-    </table>
-</div>
+            </thead>
+            <tbody>
+                {% for row in data_rows %}
+                    <tr>
+                        <td>
+                            <input type="checkbox" name="selected-submissions" class="select-submission" value="{{ row.model_id|unlocalize }}" data-action="w-bulk#toggle" data-w-bulk-target="item" />
+                        </td>
+                        {% for cell in row.fields %}
+                            <td>
+                                {% process_form_cell request cell %}
+                            </td>
+                        {% endfor %}
+                    </tr>
+                {% endfor %}
+            </tbody>
+        </table>
+        <div class="nice-padding">
+            <button class="button no w-invisible" data-w-bulk-target="action">
+                {% trans "Delete selected submissions" %}
+            </button>
+        </div>
+    </form>
+{% endblock %}
+
+{% block no_results_message %}
+    <p>
+        {% blocktrans trimmed with title=form_page.title %}
+            There have been no submissions of the '{{ title }}' form.
+        {% endblocktrans %}
+    </p>
+{% endblock %}