When opening a bookmark, each tab level will be updated separately from top to bottom according to the URL state. The navigation code has been modified to recognize when an ancestor tab is being updated and not change the URL state.
Ticket #1521 -- Endi S. Dewata
From 78ee31d4247dd7952efe6dfd6f8cc341c8da0738 Mon Sep 17 00:00:00 2001 From: Endi S. Dewata <edew...@redhat.com> Date: Mon, 25 Jul 2011 14:05:02 -0500 Subject: [PATCH] Fixed problem bookmarking Policy/IPA Server tabs When opening a bookmark, each tab level will be updated separately from top to bottom according to the URL state. The navigation code has been modified to recognize when an ancestor tab is being updated and not change the URL state. Ticket #1521 --- install/ui/navigation.js | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff --git a/install/ui/navigation.js b/install/ui/navigation.js index 605a361259bff3a45e882be50d83ab7db9c1d342..0224399736b2be2a5d86696a916411ac9be35736 100644 --- a/install/ui/navigation.js +++ b/install/ui/navigation.js @@ -67,7 +67,7 @@ IPA.navigation = function(spec) { return that.tabs_by_name[name]; }; - that.get_current_tab = function(state) { + that.get_active_tab = function(state) { var name = null; var next = state[that.root]; @@ -79,6 +79,15 @@ IPA.navigation = function(spec) { return that.get_tab(name); }; + that.is_ancestor = function(tab, ancestor) { + var parent = tab.parent; + while (parent) { + if (parent == ancestor) return true; + parent = parent.parent; + } + return false; + }; + that.get_path_state = function(name) { var path_state = {}; @@ -142,7 +151,7 @@ IPA.navigation = function(spec) { $.extend(that.path, param_path); // find the tab pointed by the path - var tab = that.get_current_tab(that.path); + var tab = that.get_active_tab(that.path); // find the active tab at the lowest level while (!tab.entity) { @@ -243,18 +252,31 @@ IPA.navigation = function(spec) { var tabs = $('.' + that.tab_class, that.container); tabs.tabs({ select: function(event, ui) { + + // get the selected tab var panel = $(ui.panel); var name = panel.attr('name'); + var selected_tab = that.get_tab(name); + // get the tab specified in the URL state var state = that.get_state(); - var tab = that.get_current_tab(state); + var url_tab = that.get_active_tab(state); - if (tab && tab.name == name) { // hash change - return that.push_state(state); + if (url_tab) { + // if they are the same, the selection is triggered by hash change + if (url_tab == selected_tab) { + // use the URL state to update internal state + return that.push_state(state); - } else { // mouse click - return that.show_page(name); + // if the selection is for the ancestor + } else if (that.is_ancestor(url_tab, selected_tab)) { + // let the tab be updated and don't change the state + return true; + } } + + // selection is triggered by mouse click, update the URL state + return that.show_page(name); } }); }; -- 1.7.5.1
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel