From 7fa9cd56f6df41df7bfd20671f5985a83a5446a6 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 1 Mar 2021 12:09:41 -0500 Subject: [PATCH] add mass selection to tag changes reversion (derpibooru/philomena#239) --- assets/js/boorujs.js | 2 ++ lib/philomena_web/templates/tag_change/index.html.slime | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/boorujs.js b/assets/js/boorujs.js index 666c3005..3d5ab920 100644 --- a/assets/js/boorujs.js +++ b/assets/js/boorujs.js @@ -38,6 +38,8 @@ const actions = { selectvalue(data) { document.querySelector(data.value).value = data.el.querySelector(':checked').dataset.setValue; }, + checkall(data) { $$(`${data.value} input[type=checkbox]`).forEach(c => { c.checked = !c.checked; }) }, + focus(data) { document.querySelector(data.value).focus(); }, preventdefault() { /* The existence of this entry is enough */ }, diff --git a/lib/philomena_web/templates/tag_change/index.html.slime b/lib/philomena_web/templates/tag_change/index.html.slime index 5fef9aca..3e5961b6 100644 --- a/lib/philomena_web/templates/tag_change/index.html.slime +++ b/lib/philomena_web/templates/tag_change/index.html.slime @@ -1,7 +1,13 @@ .block__header = @pagination -= form_for :tag_changes, Routes.tag_change_revert_path(@conn, :create), fn _f -> += if reverts_tag_changes?(@conn) do + .block__header.block__header--light.block__header--sub + a data-click-checkall=".tag-changes-form" + i.fa.fa-check> + ' Toggle all + += form_for :tag_changes, Routes.tag_change_revert_path(@conn, :create), [class: "tag-changes-form"], fn _f -> .block__content table.table thead