From 927716578e1e531bbaf749eb9aaa03a685a059d7 Mon Sep 17 00:00:00 2001 From: PeculiarE <75625011+PeculiarE@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:55:14 +0100 Subject: [PATCH 1/2] fix: unchecking select-all checkbox disables spam2 buttons --- app/assets/javascripts/spam2.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/spam2.js b/app/assets/javascripts/spam2.js index e66c99d0d9..b7218adf2f 100644 --- a/app/assets/javascripts/spam2.js +++ b/app/assets/javascripts/spam2.js @@ -16,14 +16,13 @@ function table_main(id) { "search": "Filter displayed results" } }); - $('#selectall').click(function () { + $('#selectall').on('click',function () { $('.selectedId').prop('checked', this.checked); - let selectedLength = $('.selectedId').filter(":checked").length - $('#select-count').text(selectedLength); - if(selectedLength == 0) return - disable_buttons('#selectall'); + let selectedLength = $('.selectedId').filter(":checked").length; + $('#select-count').text(selectedLength); + disable_buttons('.selectedId'); }); - $('.selectedId').change(function () { + $('.selectedId').on('change', function () { var check = ($('.selectedId').filter(":checked").length === $('.selectedId').length); $('#select-count').text($('.selectedId').filter(":checked").length); $('#selectall').prop("checked", check); @@ -70,7 +69,7 @@ function batch_nav(bulk) { function select_all() { $('.selectedId').prop('checked', !$('.selectedId').prop('checked')); - let selectedLength = $('.selectedId').filter(":checked").length + let selectedLength = $('.selectedId').filter(":checked").length; // enable buttons only if there are nodes in the table and number of selected nodes == total node length var check = (selectedLength == $('.selectedId').length && selectedLength > 0); $('#select-count').text(selectedLength); From 2c3221758025d6a7ea4ee3bb639971906584fb46 Mon Sep 17 00:00:00 2001 From: PeculiarE <75625011+PeculiarE@users.noreply.github.com> Date: Mon, 18 Apr 2022 19:05:31 +0100 Subject: [PATCH 2/2] fix: fixed indentation --- app/assets/javascripts/spam2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/spam2.js b/app/assets/javascripts/spam2.js index b7218adf2f..d52c4dc455 100644 --- a/app/assets/javascripts/spam2.js +++ b/app/assets/javascripts/spam2.js @@ -19,7 +19,7 @@ function table_main(id) { $('#selectall').on('click',function () { $('.selectedId').prop('checked', this.checked); let selectedLength = $('.selectedId').filter(":checked").length; - $('#select-count').text(selectedLength); + $('#select-count').text(selectedLength); disable_buttons('.selectedId'); }); $('.selectedId').on('change', function () {