diff --git a/assets/controllers/batch_edit_controller.js b/assets/controllers/batch_edit_controller.js new file mode 100644 index 000000000..e15fc41c5 --- /dev/null +++ b/assets/controllers/batch_edit_controller.js @@ -0,0 +1,15 @@ +import { Controller } from '@hotwired/stimulus'; + +export default class extends Controller { + static targets = ['item', 'tagAction']; + + toggleSelection(e) { + this.itemTargets.forEach((item) => { + item.checked = e.currentTarget.checked; // eslint-disable-line no-param-reassign + }); + } + + tagSelection() { + this.element.requestSubmit(this.tagActionTarget); + } +} diff --git a/assets/index.js b/assets/index.js index c02bf3740..089afd604 100755 --- a/assets/index.js +++ b/assets/index.js @@ -173,23 +173,4 @@ $(document).ready(() => { $('.nav-panel-actions').show(); return false; }); - - const mainCheckboxes = document.querySelectorAll('[data-js="checkboxes-toggle"]'); - if (mainCheckboxes.length) { - [...mainCheckboxes].forEach((el) => { - el.addEventListener('click', () => { - const checkboxes = document.querySelectorAll(el.dataset.toggle); - [...checkboxes].forEach((checkbox) => { - const checkboxClone = checkbox; - checkboxClone.checked = el.checked; - }); - }); - }); - } - $('form[name="form_mass_action"] input[name="tags"]').on('keydown', (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - $('form[name="form_mass_action"] button[name="tag"]').trigger('click'); - } - }); }); diff --git a/templates/Entry/Card/_mass_checkbox.html.twig b/templates/Entry/Card/_mass_checkbox.html.twig index 5e4fe8f6d..e972f5695 100644 --- a/templates/Entry/Card/_mass_checkbox.html.twig +++ b/templates/Entry/Card/_mass_checkbox.html.twig @@ -1,3 +1,3 @@ diff --git a/templates/Entry/entries.html.twig b/templates/Entry/entries.html.twig index 59027431f..783e4abb1 100644 --- a/templates/Entry/entries.html.twig +++ b/templates/Entry/entries.html.twig @@ -53,7 +53,7 @@ {% if current_route == 'homepage' %} {% set current_route = 'unread' %} {% endif %} -
+
{{ 'entry.list.number_on_the_page'|trans({'%count%': entries.count}) }} @@ -77,15 +77,15 @@
- +
- - + +