Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Make bulk actions bar as general as possible
dominik-zeglenfe36836921c4
diff --git a/saleor/static/dashboard/js/components/bulk-actions.js b/saleor/static/dashboard/js/components/bulk-actions.jsindex 2fd10d7299..f66a338fa8 100644--- a/saleor/static/dashboard/js/components/bulk-actions.js+++ b/saleor/static/dashboard/js/components/bulk-actions.js@@ -4,7 +4,7 @@* in browsing history and some rows are checked but have no .highlight class.*/function initCheckedRows () {- $('.select-item:checked:not(#select-all-products)')+ $('.select-item:checked:not(#select-all-items)').each((itemIndex, item) => {$(item).parent()@@ -14,7 +14,7 @@ function initCheckedRows () {}function moveSelectAllCheckbox (bulk, selectAllState) {- const $selectAll = $('#select-all-products')+ const $selectAll = $('#select-all-items').parent()[0].innerHTML;const $headerContainer = $('thead .bulk-checkbox');const $actionBarContainer = $('.data-table-bulk-actions__select-all');@@ -25,14 +25,14 @@ function moveSelectAllCheckbox (bulk, selectAllState) {$actionBarContainer.html('');$headerContainer[0].innerHTML = $selectAll;}- $actionBarContainer.find('#select-all-products')+ $actionBarContainer.find('#select-all-items').prop('checked', selectAllState);$('.select-all').on('change', onSelectAll);}function onItemSelect (e) {- const count = $('.select-item:checked').length - $('#select-all-products:checked').length;+ const count = $('.select-item:checked').length - $('#select-all-items:checked').length;const maxCount = $('.select-item').length - 1;const $target = $(e.currentTarget);$target.parent()@@ -75,7 +75,7 @@ function onSubmit (e) {}function updateSelectedItemsText (selectAllState) {- const count = $('.select-item:checked').length - $('#select-all-products:checked').length;+ const count = $('.select-item:checked').length - $('#select-all-items:checked').length;const $counterTextNode = $('.data-table-bulk-actions__selected-items');const $header = $('.data-table-bulk-actions');const counterText = ngettext('item selected', 'items selected', count);diff --git a/templates/dashboard/product/_bulk_actions_bar.html b/templates/dashboard/includes/_bulk_actions_bar.htmlsimilarity index 86%rename from templates/dashboard/product/_bulk_actions_bar.htmlrename to templates/dashboard/includes/_bulk_actions_bar.htmlindex 88779dd0a8..ae8e7dba63 100644--- a/templates/dashboard/product/_bulk_actions_bar.html+++ b/templates/dashboard/includes/_bulk_actions_bar.html@@ -15,10 +15,10 @@</ul></div><div class="data-table-bulk-actions__dropdown-container">- <a class="dropdown-button right" href="#!" data-activates="dropdown1" data-constrainwidth="false" data-gutter="-19" data-alignment="right">+ <a class="dropdown-button right" href="#!" data-activates="dropdown-bulk-actions" data-constrainwidth="false" data-gutter="-19" data-alignment="right"><svg data-src="{% static "dashboard/images/more-vert.svg" %}" height="24" width="24" /></a>- <ul id="dropdown1" class="dropdown-content">+ <ul id="dropdown-bulk-actions" class="dropdown-content">{% for action, label in bulk_action_form.action.field.widget.choices %}<li><a href=""diff --git a/templates/dashboard/product/list.html b/templates/dashboard/product/list.htmlindex f6aa850e2c..31c5da54fd 100644--- a/templates/dashboard/product/list.html+++ b/templates/dashboard/product/list.html@@ -50,14 +50,14 @@<form method="POST" action="{% url 'dashboard:product-bulk-update' %}" novalidate id="bulk-actions-form">{% csrf_token %}<input name="action" type="hidden" id="bulk-action" />- {% include 'dashboard/product/_bulk_actions_bar.html' %}+ {% include 'dashboard/product/../includes/_bulk_actions_bar.html' %}<div class="data-table-container"><table class="bordered highlight responsive data-table last-right-align"><thead><tr><th class="bulk-checkbox">- <input id="select-all-products" type="checkbox" class="filled-in select-all switch-actions select-item">- <label for="select-all-products"></label>+ <input id="select-all-items" type="checkbox" class="filled-in select-all select-item">+ <label for="select-all-items"></label></th><th></th>{% trans "Name" context "Products list table header" as label %}@@ -71,7 +71,7 @@{% for product in products %}<tr class="avatar" data-action-go="{% url 'dashboard:product-detail' pk=product.pk %}"><td class="bulk-checkbox ignore-link">- <input id="id_products_{{ product.pk }}" type="checkbox" name="products" value="{{ product.pk }}" class="filled-in switch-actions select-item">+ <input id="id_products_{{ product.pk }}" type="checkbox" name="products" value="{{ product.pk }}" class="filled-in select-item"><label for="id_products_{{ product.pk }}"></label></td><td class="avatar">