From a88eb813956a1fd637b0a11ebbd2f3e1a0865b09 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 13 Apr 2010 06:57:12 +0000 Subject: [PATCH] API CHANGE: Added capability for batch actions to indicate failure through red checkboxes (from r94868) (from r96824) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102701 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- images/tickbox-fail.gif | Bin 0 -> 64 bytes images/tickbox-greyedout.gif | Bin 0 -> 64 bytes javascript/LeftAndMain.BatchActions.js | 25 +++++++++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 images/tickbox-fail.gif create mode 100644 images/tickbox-greyedout.gif diff --git a/images/tickbox-fail.gif b/images/tickbox-fail.gif new file mode 100644 index 0000000000000000000000000000000000000000..88666fe29b0439358c284ae82097dec8493d72fa GIT binary patch literal 64 zcmZ?wbhEHbasuv25SHr3K6>i literal 0 HcmV?d00001 diff --git a/images/tickbox-greyedout.gif b/images/tickbox-greyedout.gif new file mode 100644 index 0000000000000000000000000000000000000000..df2106f98185aedc88d2aaf00b8af33371a228be GIT binary patch literal 64 zcmZ?wbhEHb=cy7_0$W*Aox` literal 0 HcmV?d00001 diff --git a/javascript/LeftAndMain.BatchActions.js b/javascript/LeftAndMain.BatchActions.js index 9cf6076e..dc158deb 100644 --- a/javascript/LeftAndMain.BatchActions.js +++ b/javascript/LeftAndMain.BatchActions.js @@ -185,6 +185,9 @@ // write (possibly modified) IDs back into to the hidden field this.setIDs(ids); + + // Reset failure states + $(tree).find('li').removeClass('failed'); var button = this.find(':submit:first'); button.addClass('loading'); @@ -216,10 +219,19 @@ if(node && node.parentTreeNode) node.parentTreeNode.removeTreeNode(node); } } + if(data.error) { + for(id in data.error) { + var node = tree.getTreeNodeByIdx(id); + $(node).addClass('failed'); + } + } + + // Deselect all nodes + $(tree).find('li').removeClass('selected'); // reset selection state // TODO Should unselect all selected nodes as well - jQuery(tree).removeClass('multiselect'); + // jQuery(tree).removeClass('multiselect'); // Check if current page still exists, and refresh it. // Otherwise remove the current form @@ -238,7 +250,7 @@ // close panel // TODO Coupling with tabs - jQuery('#TreeActions').tabs('select', -1); + // jQuery('#TreeActions').tabs('select', -1); }, dataType: 'json' }); @@ -256,8 +268,7 @@ // auto-select the current node var node = this.getTree().firstSelected(); if(node){ - node.removeNodeClass('current'); - node.addNodeClass('selected'); + $(node).removeClass('current').addClass('selected'); node.open(); // Open all existing children, which might trigger further @@ -277,12 +288,10 @@ if(!this._isActive()) return; if(node.selected) { - node.removeNodeClass('selected'); - node.selected = false; + $(node).removeClass('selected').attr('selected', false); } else { // Select node - node.addNodeClass('selected'); - node.selected = true; + $(node).addClass('selected').attr('selected', true); // Open node in order to allow proper selection of children if($(node).hasClass('unexpanded')) {