From 50da6c7f3cb6caca1895b84560d2fada7caf2215 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 14 Sep 2020 23:30:48 -0400 Subject: [PATCH] add quick tag button to toggle all --- assets/js/quick-tag.js | 6 ++++++ lib/philomena_web/templates/image/_quick_tag.html.slime | 3 +++ 2 files changed, 9 insertions(+) diff --git a/assets/js/quick-tag.js b/assets/js/quick-tag.js index 56fc1540..635b9617 100644 --- a/assets/js/quick-tag.js +++ b/assets/js/quick-tag.js @@ -21,6 +21,7 @@ function toggleActiveState() { toggleEl($('.js-quick-tag'), $('.js-quick-tag--abort'), + $('.js-quick-tag--all'), $('.js-quick-tag--submit')); setTagButton(`Submit (${currentTags()})`); @@ -85,12 +86,17 @@ function modifyImageQueue(mediaBox) { } +function toggleAllImages() { + $$('#imagelist-container .media-box').forEach(modifyImageQueue); +} + function clickHandler(event) { const targets = { '.js-quick-tag': activate, '.js-quick-tag--abort': reset, '.js-quick-tag--submit': submit, + '.js-quick-tag--all': toggleAllImages, '.media-box': modifyImageQueue, }; diff --git a/lib/philomena_web/templates/image/_quick_tag.html.slime b/lib/philomena_web/templates/image/_quick_tag.html.slime index 9483853a..95d5398a 100644 --- a/lib/philomena_web/templates/image/_quick_tag.html.slime +++ b/lib/philomena_web/templates/image/_quick_tag.html.slime @@ -4,6 +4,9 @@ a.js-quick-tag href="#" title="Add tags to the images on this page" a.js-quick-tag--abort.hidden href="#" i.fa.fa-exclamation-triangle span.hide-mobile.hide-limited-desktop<> Abort Tagging +a.js-quick-tag--all.hidden href="#" + i.fa.fa-arrows-alt-h + span.hide-mobile.hide-limited-desktop<> Toggle All a.js-quick-tag--submit.hidden href="#" i.fa.fa-tags span.hide-mobile.hide-limited-desktop<> Submit Tag Changes