From 69bf18f784625f011cda61ec7b82a1785ae2c5ae Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 30 Mar 2012 09:38:56 -0400 Subject: [PATCH] Custom Org Tree : Admin UI honors "activate" on new trees Previously, activating a new tree would work, but the UI did not update to reflect it. Now the activate link correctly turns into a de-activate link and vice versa. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../global/actor/org_unit_custom_tree.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js b/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js index cc835f79dc..695a9c4685 100644 --- a/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js +++ b/Open-ILS/web/js/ui/default/conify/global/actor/org_unit_custom_tree.js @@ -247,7 +247,15 @@ function deleteSelected() { function activateTree() { mTree.active('t'); - if (mTree.isnew()) return; + + if (mTree.isnew()) { + // before the tree exists, we can only activate the local copy + // the next save event will activate it + openils.Util.hide(dojo.byId('activate-tree')); + openils.Util.show(dojo.byId('deactivate-tree'), 'inline'); + return; + } + pcrud.update(mTree, { oncomplete : function() { openils.Util.hide(dojo.byId('activate-tree')); @@ -258,7 +266,13 @@ function activateTree() { function deactivateTree() { mTree.active('f'); - if (mTree.isnew()) return; + + if (mTree.isnew()) { + openils.Util.hide(dojo.byId('deactivate-tree')); + openils.Util.show(dojo.byId('activate-tree'), 'inline'); + return; + } + pcrud.update(mTree, { oncomplete : function() { openils.Util.hide(dojo.byId('deactivate-tree')); -- 2.43.2