summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-07-25 14:05:02 -0500
committerAdam Young <ayoung@redhat.com>2011-07-26 17:06:01 -0400
commit61ff6ff107ad22be6aea3beb78bfc07efc81adb7 (patch)
tree4a06a12485195edc28bd3cffefd54c270e706412
parent87821f2049fb6f630c27e08d9939205bc87513e2 (diff)
downloadfreeipa-61ff6ff107ad22be6aea3beb78bfc07efc81adb7.zip
freeipa-61ff6ff107ad22be6aea3beb78bfc07efc81adb7.tar.gz
freeipa-61ff6ff107ad22be6aea3beb78bfc07efc81adb7.tar.xz
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
-rw-r--r--install/ui/navigation.js40
1 files changed, 31 insertions, 9 deletions
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 605a361..0224399 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);
-
- if (tab && tab.name == name) { // hash change
- return that.push_state(state);
-
- } else { // mouse click
- return that.show_page(name);
+ var url_tab = that.get_active_tab(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);
+
+ // 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);
}
});
};