summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-03-08 14:36:59 -0600
committerAdam Young <ayoung@redhat.com>2011-03-08 17:05:01 -0500
commited5cffd026a6528ea47802d16417139dd2734980 (patch)
treed8ee085ba5cab222b882e5dddd91f97aed2ae578
parent1c741e62780e966cc0d1efc6541bd19e2c9e4e86 (diff)
downloadfreeipa-ed5cffd026a6528ea47802d16417139dd2734980.tar.gz
freeipa-ed5cffd026a6528ea47802d16417139dd2734980.tar.xz
freeipa-ed5cffd026a6528ea47802d16417139dd2734980.zip
Fixed self service page.
Collaborated with ayoung to fix this problem: https://fedorahosted.org/freeipa/ticket/1070
-rw-r--r--install/ui/navigation.js2
-rw-r--r--install/ui/test/navigation_tests.js18
-rw-r--r--install/ui/webui.js19
3 files changed, 31 insertions, 8 deletions
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 3612d1e6..365bde66 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -62,8 +62,6 @@ IPA.nav = {
return IPA.nav.push_state(state);
}
});
-
- IPA.nav.update_tabs();
},
generate_tabs : function (nls, container, tabclass, depth) {
diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js
index 29b1cfab..7eb14ce4 100644
--- a/install/ui/test/navigation_tests.js
+++ b/install/ui/test/navigation_tests.js
@@ -19,7 +19,20 @@
*/
-module('navigation');
+module('navigation', {
+ setup: function() {
+ IPA.ajax_options.async = false;
+ IPA.init(
+ 'data',
+ true,
+ function(data, text_status, xhr) {
+ },
+ function(xhr, text_status, error_thrown) {
+ ok(false, 'ipa_init() failed: '+error_thrown);
+ }
+ );
+ }
+});
test("Testing IPA.nav.create().", function() {
@@ -37,7 +50,7 @@ test("Testing IPA.nav.create().", function() {
user_mock_called = true;
same(container[0].id,'user','user id');
same(container[0].nodeName,'DIV','user div');
- }
+ };
return that;
};
IPA.entity_factories.group = function(){
@@ -57,6 +70,7 @@ test("Testing IPA.nav.create().", function() {
var user_mock_called = false;
var group_mock_called = false;
IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
+ IPA.nav.update_tabs();
ok(user_mock_called, "mock user setup was called");
ok(!group_mock_called, "mock group setup was not called because the tab is inactive");
same( navigation[0].children.length, 2, "Two Child tabs");
diff --git a/install/ui/webui.js b/install/ui/webui.js
index fd33120d..3223cbf0 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -149,14 +149,25 @@ $(function() {
if (should_show_all_ui()){
IPA.tab_set = IPA.admin_tab_set();
IPA.nav.create(IPA.tab_set, navigation, 'tabs');
+ IPA.nav.update_tabs();
+
} else {
IPA.tab_set = IPA.self_serv_tab_set();
IPA.nav.create(IPA.tab_set, navigation, 'tabs');
- var state = {'user-pkey':IPA.whoami_pkey ,
- 'user-facet': $.bbq.getState('user-facet') ||
- 'details'};
- $.bbq.pushState(state);
+ var pkey = $.bbq.getState('user-pkey');
+ var facet = $.bbq.getState('user-facet');
+
+ if (pkey && facet) {
+ IPA.nav.update_tabs();
+
+ } else {
+ var state = {
+ 'user-pkey': pkey || IPA.whoami_pkey,
+ 'user-facet': facet || 'details'
+ };
+ $.bbq.pushState(state);
+ }
}