0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Hide "delete snippets" button when no snippets selected

This commit is contained in:
Karl Hobley 2018-11-19 11:02:09 +00:00 committed by Matt Westcott
parent 12ac86217a
commit 4abfbf89a0
4 changed files with 5 additions and 3 deletions

View File

@ -21,6 +21,7 @@ Changelog
* Cleanup: Use `functools.partial()` instead of `django.utils.functional.curry()` (Sergey Fedoseev)
* Squashed migrations for wagtailcore and wagtailimages (Karl Hobley)
* Added `before_move_page` and `after_move_page` hooks (Maylon Pedroso)
* Bulk deletion button for snippets is now hidden until items are selected (Karl Hobley)
* Fix: Query objects returned from `PageQuerySet.type_q` can now be merged with `|` (Brady Moe)
* Fix: Add `rel="noopener noreferrer"` to target blank links (Anselm Bradford)
* Fix: Additional fields on custom document models now show on the multiple document upload view (Robert Rollins, Sergey Fedoseev)

View File

@ -39,6 +39,7 @@ Other features
* Cleanup: Use ``functools.partial()`` instead of ``django.utils.functional.curry()`` (Sergey Fedoseev)
* Squashed migrations for wagtailcore and wagtailimages (Karl Hobley)
* Added ``before_move_page`` and ``after_move_page`` hooks (Maylon Pedroso)
* Bulk deletion button for snippets is now hidden until items are selected (Karl Hobley)
Bug fixes
~~~~~~~~~

View File

@ -19,13 +19,13 @@ var updateDeleteButton = function(anySelected, newState) {
});
if (anySelected) {
// enable button and add url
$deleteButton.removeClass('disabled');
$deleteButton.removeClass('visuallyhidden');
var url = $deleteButton.data('url');
url = url + $.param({id: ids}, true);
$deleteButton.attr('href', url);
} else {
// disable button and remove url
$deleteButton.addClass('disabled');
$deleteButton.addClass('visuallyhidden');
$deleteButton.attr('href', null);
}
};

View File

@ -37,7 +37,7 @@
</div>
<div class="right col6">
{% if can_delete_snippets %}
<a class="button bicolor icon icon-bin serious disabled delete-button" data-url="{% url 'wagtailsnippets:delete-multiple' model_opts.app_label model_opts.model_name %}?">{% blocktrans with snippet_type_name=model_opts.verbose_name_plural %}Delete {{ snippet_type_name }}{% endblocktrans %}</a>
<a class="button bicolor icon icon-bin serious delete-button visuallyhidden" data-url="{% url 'wagtailsnippets:delete-multiple' model_opts.app_label model_opts.model_name %}?">{% blocktrans with snippet_type_name=model_opts.verbose_name_plural %}Delete {{ snippet_type_name }}{% endblocktrans %}</a>
{% endif %}
{% if can_add_snippet %}
<a href="{% url 'wagtailsnippets:add' model_opts.app_label model_opts.model_name %}" class="button bicolor icon icon-plus">{% blocktrans with snippet_type_name=model_opts.verbose_name %}Add {{ snippet_type_name }}{% endblocktrans %}</a>