Parcourir la source

Improve the snippet UI by offering 'Don't delete' actions to the edit form

kevinhowbrook il y a 6 ans
Parent
commit
1079b7f021

+ 1 - 0
CHANGELOG.txt

@@ -22,6 +22,7 @@ Changelog
  * Add support for more rich text formats, disabled by default: `blockquote`, `superscript`, `subscript`, `strikethrough`, `code` (Md Arifin Ibne Matin)
  * Added `max_count_per_parent` option on page models to limit the number of pages of a given type that can be created under one parent page (Wesley van Lee)
  * `StreamField` field blocks now accept a `validators` argument (Tom Usher)
+ * Added edit / delete buttons to snippet index and "don't delete" option to confirmation screen, for consistency with pages (Kevin Howbrook)
  * Fix: Set `SERVER_PORT` to 443 in `Page.dummy_request()` for HTTPS sites (Sergey Fedoseev)
  * Fix: Include port number in `Host` header of `Page.dummy_request()` (Sergey Fedoseev)
  * Fix: Validation error messages in `InlinePanel` no longer count towards `max_num` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)

+ 1 - 0
docs/releases/2.5.rst

@@ -32,6 +32,7 @@ Other features
  * Add support for more rich text formats, disabled by default: ``blockquote``, ``superscript``, ``subscript``, ``strikethrough``, ``code`` (Md Arifin Ibne Matin)
  * Added ``max_count_per_parent`` option on page models to limit the number of pages of a given type that can be created under one parent page (Wesley van Lee)
  * ``StreamField`` field blocks now accept a ``validators`` argument (Tom Usher)
+ * Added edit / delete buttons to snippet index and "don't delete" option to confirmation screen, for consistency with pages (Kevin Howbrook)
 
 
 Bug fixes

+ 1 - 0
wagtail/snippets/templates/wagtailsnippets/snippets/confirm_delete.html

@@ -35,6 +35,7 @@
         <form action="{{ submit_url }}" method="POST">
             {% csrf_token %}
             <input type="submit" value="{% trans 'Yes, delete' %}" class="button serious" />
+            <a href="{% if next %}{{ next }}{% else %}{% url 'wagtailsnippets:list' model_opts.app_label model_opts.model_name %}{% endif %}" class="button button-secondary">{% trans "No, don't delete" %}</a>
         </form>
     </div>
 

+ 10 - 0
wagtail/snippets/templates/wagtailsnippets/snippets/list.html

@@ -21,6 +21,16 @@
                         <h2><a class="snippet-choice" href="{% url 'wagtailsnippets:chosen' model_opts.app_label model_opts.model_name snippet.pk|admin_urlquote %}">{{ snippet }}</a></h2>
                     {% else %}
                         <h2><a href="{% url 'wagtailsnippets:edit' model_opts.app_label model_opts.model_name snippet.pk|admin_urlquote %}">{{ snippet }}</a></h2>
+                         <ul class="actions">
+                            <li>
+                                <a href="{% url 'wagtailsnippets:edit' model_opts.app_label model_opts.model_name snippet.pk|admin_urlquote %}" class="button button-secondary button-small">Edit</a>
+                            </li>
+                            {% if can_delete_snippets %}
+                                <li>
+                                    <a href="{% url 'wagtailsnippets:delete' model_opts.app_label model_opts.model_name snippet.pk|admin_urlquote %}" class="button button-secondary button-small">Delete</a>
+                                </li>
+                            {% endif %}
+                        </ul>
                     {% endif %}
                 </td>
             </tr>