Files
openfoodnetwork/app/webpacker/controllers/select_all_controller.js
Cillian O'Ruanaidh 0673f9a5ae Use a more simple layout on the order cycle checkout options form
Before there was a row for each distributor and a 'shared' row for shipping methods which were shared among more than one distributor. This layout displays a single list of shipping methods with the distributor or distributors it belongs to beside it as suggested by @lin-d-hop
2022-09-30 13:13:39 +01:00

16 lines
362 B
JavaScript

import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["all", "checkbox"];
toggleAll() {
this.checkboxTargets.forEach(checkbox => {
checkbox.checked = this.allTarget.checked;
});
}
toggleCheckbox() {
this.allTarget.checked = this.checkboxTargets.every(checkbox => checkbox.checked);
}
}