From: Bill Erickson Date: Fri, 30 Mar 2012 13:38:56 +0000 (-0400) Subject: Custom Org Tree : Admin UI honors "activate" on new trees X-Git-Tag: sprint4-merge-nov22~4304 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=69bf18f784625f011cda61ec7b82a1785ae2c5ae;p=working%2FEvergreen.git 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 --- 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'));