Fixed self service page.

Collaborated with ayoung to fix this problem:
https://fedorahosted.org/freeipa/ticket/1070
This commit is contained in:
Endi S. Dewata
2011-03-08 14:36:59 -06:00
committed by Adam Young
parent 1c741e6278
commit ed5cffd026
3 changed files with 31 additions and 8 deletions

View File

@@ -62,8 +62,6 @@ IPA.nav = {
return IPA.nav.push_state(state);
}
});
IPA.nav.update_tabs();
},
generate_tabs : function (nls, container, tabclass, depth) {

View File

@@ -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");

View File

@@ -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);
}
}