From 676ac36d7de304e0ae3954ba00416fb1d9b10588 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 11 May 2016 16:53:49 +0200 Subject: [PATCH] item deletion: fix for don't showing the delete button if item is getting unchecked but other items are still checked --- js/theme.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/js/theme.js b/js/theme.js index 5cc5e49f0..e6f4da325 100644 --- a/js/theme.js +++ b/js/theme.js @@ -70,17 +70,26 @@ $(document).ready(function(){ // show bulk deletion button at network page if checkbox is checked $('input.item-select').change(function(){ + var checked = false; - if($(this).is(':checked')) { - $("a#item-delete-selected").fadeTo('slow', 1); + // We need to get all checked items, so it would close the delete button + // if we uncheck one item and others are still checked. + // So return checked = true if there is any checked item + $('input.item-select').each( function() { + if($(this).is(':checked')) { + checked = true; + return false; + } + }); + + if(checked == true) { + $("a#item-delete-selected").fadeTo(400, 1); $("a#item-delete-selected").show(); } else { - $("a#item-delete-selected").fadeTo('slow', 0, function(){ + $("a#item-delete-selected").fadeTo(400, 0, function(){ $("a#item-delete-selected").hide(); - }); - + }); } - }); // add search-headding to the scecond navbar @@ -431,3 +440,7 @@ String.prototype.rtrim = function() { var trimmed = this.replace(/\s+$/g, ''); return trimmed; }; + +function checkSelected() { + +}