summaryrefslogtreecommitdiffstats
path: root/install/ui/navigation.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-06-28 13:39:10 -0400
committerEndi S. Dewata <edewata@redhat.com>2011-06-28 22:40:42 +0000
commit66eeaceb8cc50902b408e5c97c6d04e59e57f97a (patch)
treed279fd33648bf1470f566afca418b876683748a2 /install/ui/navigation.js
parent67b807d6402942061d9762f2c1ff31779b7d4744 (diff)
downloadfreeipa-66eeaceb8cc50902b408e5c97c6d04e59e57f97a.tar.gz
freeipa-66eeaceb8cc50902b408e5c97c6d04e59e57f97a.tar.xz
freeipa-66eeaceb8cc50902b408e5c97c6d04e59e57f97a.zip
shorten url cache state in a javascript variable, and leave on information about the current entity in the URL hash params
https://fedorahosted.org/freeipa/ticket/674 decrement depth for hidden tabs. Initialize state from url useing delete for removing state stricter attribute matching not incrementing depth for all hidden tabs. whitespace cleanup
Diffstat (limited to 'install/ui/navigation.js')
-rw-r--r--install/ui/navigation.js46
1 files changed, 38 insertions, 8 deletions
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 5d70f8792..d0b45cc3c 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -65,23 +65,25 @@ IPA.navigation = function(spec) {
that.get_path_state = function(name) {
- var state = {};
+ var path_state = {};
var tab = that.get_tab(name);
var parent = tab.parent;
while (parent) {
- state[parent.name] = tab.name;
+ path_state[parent.name] = tab.name;
tab = parent;
parent = tab.parent;
}
- state[that.container.attr('id')] = tab.name;
+ path_state[that.container.attr('id')] = tab.name;
- return state;
+ return path_state;
};
+ var state = $.bbq.getState();
+
that.push_state = function(params) {
if (IPA.current_entity) {
@@ -104,15 +106,37 @@ IPA.navigation = function(spec) {
}
}
- $.bbq.pushState(params);
+ for ( var param in params){
+ state[param] = params[param];
+ }
+
+ var url_state ={};
+ var key = 'navigation';
+ while(state[key]){
+ var value = state[key];
+ url_state[key] = value;
+ var entity = value;
+ for (var key2 in state){
+ if ((key2 === entity) || (key2.search('^'+entity) > -1)){
+ url_state[key2] = state[key2];
+ }
+ }
+ key = value;
+ }
+ $.bbq.pushState(url_state,2);
return true;
};
that.get_state = function(key) {
- return $.bbq.getState(key);
+ var url_state = $.bbq.getState(key);
+ if (!url_state){
+ url_state = state[key];
+ }
+ return url_state;
};
that.remove_state = function(key) {
+ delete state[key];
$.bbq.removeState(key);
};
@@ -218,15 +242,21 @@ IPA.navigation = function(spec) {
container.tabs('select', index);
var tab = tabs[index];
+ if (tab.hidden){
+ depth = depth -1;
+ }
if (tab.children && tab.children.length) {
- that._update(tab.children, tab.container, depth+1);
+ var next_depth = depth + 1;
+ that._update(tab.children, tab.container, next_depth);
} else if (tab.entity) {
+
that.container.addClass(that.tab_class+'-'+depth);
that.content.addClass(that.tab_class+'-'+depth);
- var entity_container = $('.entity[name="'+tab.entity.name+'"]', that.content);
+ var entity_container = $('.entity[name="'+tab.entity.name+'"]',
+ that.content);
if (!entity_container.length) {
tab.content = $('<div/>', {
name: tab.name,