diff --git a/app/views/admin/dfc_product_imports/index.html.haml b/app/views/admin/dfc_product_imports/index.html.haml index b3b38cbe69..0bb4821cd1 100644 --- a/app/views/admin/dfc_product_imports/index.html.haml +++ b/app/views/admin/dfc_product_imports/index.html.haml @@ -16,7 +16,7 @@ %thead %tr %th - %input{ type: 'checkbox', title: t('.select_all'), 'aria-label': t('.select_all'), data: { "checked-target": "all", action: "change->checked#toggleAll" } } + %input{ type: 'checkbox', title: t('.select_all'), 'aria-label': t('.select_all'), 'data-checked-target': "all" } %th %tbody - @items.each do |supplied_product, existing_product| diff --git a/app/views/admin/order_cycles/checkout_options.html.haml b/app/views/admin/order_cycles/checkout_options.html.haml index e43d322b09..9810745e8d 100644 --- a/app/views/admin/order_cycles/checkout_options.html.haml +++ b/app/views/admin/order_cycles/checkout_options.html.haml @@ -25,7 +25,7 @@ %td.text-center - if distributor_shipping_methods.many? %label - = check_box_tag nil, nil, nil, { "data-action": "change->checked#toggleAll", "data-checked-target": "all" } + = check_box_tag nil, nil, nil, { "data-checked-target": "all" } = t(".select_all") %td %em= distributor.name diff --git a/app/views/spree/admin/orders/_table.html.haml b/app/views/spree/admin/orders/_table.html.haml index 237e309106..65ff904bec 100644 --- a/app/views/spree/admin/orders/_table.html.haml +++ b/app/views/spree/admin/orders/_table.html.haml @@ -10,7 +10,7 @@ %thead %tr %th - %input#selectAll{ type: 'checkbox', data: { "checked-target": "all", action: "change->checked#toggleAll" } } + %input#selectAll{ type: 'checkbox', 'data-checked-target': "all" } %th = t(:products_distributor) diff --git a/app/webpacker/controllers/checked_controller.js b/app/webpacker/controllers/checked_controller.js index acca8ec0dd..84589ef903 100644 --- a/app/webpacker/controllers/checked_controller.js +++ b/app/webpacker/controllers/checked_controller.js @@ -6,6 +6,8 @@ export default class extends Controller { connect() { this.toggleCheckbox(); + + this.allTarget.addEventListener("change", this.toggleAll.bind(this)); } toggleAll() { diff --git a/spec/javascripts/stimulus/checked_controller_test.js b/spec/javascripts/stimulus/checked_controller_test.js index 772d519ea0..bfa0712844 100644 --- a/spec/javascripts/stimulus/checked_controller_test.js +++ b/spec/javascripts/stimulus/checked_controller_test.js @@ -17,7 +17,6 @@ describe("CheckedController", () => { {