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

pull/5117/head
kevinhowbrook 2019-03-19 15:00:11 +00:00 zatwierdzone przez Matt Westcott
rodzic 2a1d5b6065
commit 1079b7f021
4 zmienionych plików z 13 dodań i 0 usunięć

Wyświetl plik

@ -22,6 +22,7 @@ Changelog
* Add support for more rich text formats, disabled by default: `blockquote`, `superscript`, `subscript`, `strikethrough`, `code` (Md Arifin Ibne Matin) * 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) * 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) * `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: 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: 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) * Fix: Validation error messages in `InlinePanel` no longer count towards `max_num` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)

Wyświetl plik

@ -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) * 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) * 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) * ``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 Bug fixes

Wyświetl plik

@ -35,6 +35,7 @@
<form action="{{ submit_url }}" method="POST"> <form action="{{ submit_url }}" method="POST">
{% csrf_token %} {% csrf_token %}
<input type="submit" value="{% trans 'Yes, delete' %}" class="button serious" /> <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> </form>
</div> </div>

Wyświetl plik

@ -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> <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 %} {% else %}
<h2><a href="{% url 'wagtailsnippets:edit' model_opts.app_label model_opts.model_name snippet.pk|admin_urlquote %}">{{ snippet }}</a></h2> <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 %} {% endif %}
</td> </td>
</tr> </tr>