mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Moved entity contents outside navigation.
Previously the entities and navigation are entangled inside a common DOM structure which limits code reuse. Now they have been moved into separate structures.
This commit is contained in:
parent
5eb9f088f2
commit
dd89c28654
@ -799,25 +799,6 @@ IPA.association_facet = function (spec) {
|
|||||||
return pkey != that.pkey;
|
return pkey != that.pkey;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.create_action_panel = function(container) {
|
|
||||||
|
|
||||||
that.facet_create_action_panel(container);
|
|
||||||
|
|
||||||
var buttons = $('.action-controls', container);
|
|
||||||
|
|
||||||
$('<input/>', {
|
|
||||||
'type': 'button',
|
|
||||||
'name': 'remove',
|
|
||||||
'value': IPA.messages.buttons.remove
|
|
||||||
}).appendTo(buttons);
|
|
||||||
|
|
||||||
$('<input/>', {
|
|
||||||
'type': 'button',
|
|
||||||
'name': 'add',
|
|
||||||
'value': IPA.messages.buttons.enroll
|
|
||||||
}).appendTo(buttons);
|
|
||||||
};
|
|
||||||
|
|
||||||
that.create_content = function(container) {
|
that.create_content = function(container) {
|
||||||
|
|
||||||
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
||||||
|
@ -264,13 +264,9 @@ IPA.details_facet = function(spec) {
|
|||||||
|
|
||||||
var that = IPA.facet(spec);
|
var that = IPA.facet(spec);
|
||||||
|
|
||||||
that.label = ( IPA.messages && IPA.messages.facets && IPA.messages.facets.details) || spec.label;
|
that.label = (IPA.messages && IPA.messages.facets && IPA.messages.facets.details) || spec.label;
|
||||||
that.is_dirty = spec.is_dirty || is_dirty;
|
|
||||||
that.create_content = spec.create_content || create_content;
|
|
||||||
that.setup = spec.setup || setup;
|
|
||||||
that.load = spec.load || load;
|
|
||||||
that.update = spec.update || IPA.details_update;
|
that.update = spec.update || IPA.details_update;
|
||||||
that.reset = spec.reset || reset;
|
|
||||||
that.refresh = spec.refresh || IPA.details_refresh;
|
that.refresh = spec.refresh || IPA.details_refresh;
|
||||||
|
|
||||||
that.sections = [];
|
that.sections = [];
|
||||||
@ -323,24 +319,7 @@ IPA.details_facet = function(spec) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.create_action_panel = function(container) {
|
that.create_content = function(container) {
|
||||||
|
|
||||||
that.facet_create_action_panel(container);
|
|
||||||
|
|
||||||
var buttons = $('.action-controls', container);
|
|
||||||
|
|
||||||
$('<input/>', {
|
|
||||||
'type': 'text',
|
|
||||||
'name': 'reset'
|
|
||||||
}).appendTo(buttons);
|
|
||||||
|
|
||||||
$('<input/>', {
|
|
||||||
'type': 'text',
|
|
||||||
'name': 'update'
|
|
||||||
}).appendTo(buttons);
|
|
||||||
};
|
|
||||||
|
|
||||||
function create_content(container) {
|
|
||||||
|
|
||||||
var label = IPA.metadata.objects[that.entity_name].label;
|
var label = IPA.metadata.objects[that.entity_name].label;
|
||||||
|
|
||||||
@ -399,9 +378,9 @@ IPA.details_facet = function(spec) {
|
|||||||
|
|
||||||
details.append('<hr/>');
|
details.append('<hr/>');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function setup(container) {
|
that.setup = function(container) {
|
||||||
|
|
||||||
that.facet_setup(container);
|
that.facet_setup(container);
|
||||||
|
|
||||||
@ -468,7 +447,7 @@ IPA.details_facet = function(spec) {
|
|||||||
|
|
||||||
section.setup(div);
|
section.setup(div);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function toggle(section, visible) {
|
function toggle(section, visible) {
|
||||||
var header = $('h2[name='+section.name+']', that.container);
|
var header = $('h2[name='+section.name+']', that.container);
|
||||||
@ -491,7 +470,7 @@ IPA.details_facet = function(spec) {
|
|||||||
that.new_key = new_key;
|
that.new_key = new_key;
|
||||||
|
|
||||||
|
|
||||||
function is_dirty() {
|
that.is_dirty = function() {
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
for ( i =0; i < that.sections.length; i +=1 ){
|
for ( i =0; i < that.sections.length; i +=1 ){
|
||||||
@ -501,9 +480,9 @@ IPA.details_facet = function(spec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
function load(record) {
|
that.load = function (record) {
|
||||||
that.record = record;
|
that.record = record;
|
||||||
for (var i=0; i<that.sections.length; i++) {
|
for (var i=0; i<that.sections.length; i++) {
|
||||||
var section = that.sections[i];
|
var section = that.sections[i];
|
||||||
@ -512,15 +491,15 @@ IPA.details_facet = function(spec) {
|
|||||||
if (that.pkey){
|
if (that.pkey){
|
||||||
that.entity_header.set_pkey(that.pkey);
|
that.entity_header.set_pkey(that.pkey);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function reset() {
|
that.reset = function() {
|
||||||
|
|
||||||
for (var i=0; i<that.sections.length; i++) {
|
for (var i=0; i<that.sections.length; i++) {
|
||||||
var section = that.sections[i];
|
var section = that.sections[i];
|
||||||
section.reset();
|
section.reset();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
that.details_facet_init = that.init;
|
that.details_facet_init = that.init;
|
||||||
that.details_facet_create_content = that.create_content;
|
that.details_facet_create_content = that.create_content;
|
||||||
|
@ -304,25 +304,6 @@ IPA.records_facet = function (spec){
|
|||||||
return pkey != that.pkey || record != that.record;
|
return pkey != that.pkey || record != that.record;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.create_action_panel = function(container) {
|
|
||||||
|
|
||||||
that.facet_create_action_panel(container);
|
|
||||||
|
|
||||||
var buttons = $('.action-controls', container);
|
|
||||||
|
|
||||||
$('<input/>', {
|
|
||||||
'type': 'button',
|
|
||||||
'name': 'remove',
|
|
||||||
'value': IPA.messages.buttons.remove
|
|
||||||
}).appendTo(buttons);
|
|
||||||
|
|
||||||
$('<input/>', {
|
|
||||||
'type': 'button',
|
|
||||||
'name': 'add',
|
|
||||||
'value': IPA.messages.buttons.add
|
|
||||||
}).appendTo(buttons);
|
|
||||||
};
|
|
||||||
|
|
||||||
function create_content(container) {
|
function create_content(container) {
|
||||||
|
|
||||||
$('<h1/>',{
|
$('<h1/>',{
|
||||||
@ -537,7 +518,7 @@ IPA.records_facet = function (spec){
|
|||||||
|
|
||||||
//TODO this is cut and pasted from search, we need to unify
|
//TODO this is cut and pasted from search, we need to unify
|
||||||
function display(obj_name, data){
|
function display(obj_name, data){
|
||||||
var selector = '.entity-container[title=' + obj_name + ']';
|
var selector = '.entity-container[name=' + obj_name + ']';
|
||||||
var thead = $(selector + ' thead');
|
var thead = $(selector + ' thead');
|
||||||
var tbody = $(selector + ' tbody');
|
var tbody = $(selector + ' tbody');
|
||||||
var tfoot = $(selector + ' tfoot');
|
var tfoot = $(selector + ' tfoot');
|
||||||
|
@ -282,8 +282,7 @@ IPA.current_facet = function (entity){
|
|||||||
return facet_name;
|
return facet_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IPA.entity_setup = function(container) {
|
||||||
IPA.entity_setup = function (container) {
|
|
||||||
|
|
||||||
var entity = this;
|
var entity = this;
|
||||||
|
|
||||||
@ -303,7 +302,6 @@ IPA.entity_setup = function (container) {
|
|||||||
IPA.entity_name = entity.name;
|
IPA.entity_name = entity.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
container.attr('title', entity.name);
|
|
||||||
if (!entity.header){
|
if (!entity.header){
|
||||||
entity.header = IPA.entity_header({entity:entity,container:container});
|
entity.header = IPA.entity_header({entity:entity,container:container});
|
||||||
}
|
}
|
||||||
@ -316,7 +314,6 @@ IPA.entity_setup = function (container) {
|
|||||||
facet.refresh();
|
facet.refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.nested_tab_labels = {};
|
IPA.nested_tab_labels = {};
|
||||||
|
|
||||||
IPA.get_nested_tab_label = function(entity_name){
|
IPA.get_nested_tab_label = function(entity_name){
|
||||||
@ -538,10 +535,7 @@ IPA.entity_header = function(spec){
|
|||||||
|
|
||||||
function entity_container() {
|
function entity_container() {
|
||||||
that.entity_container =
|
that.entity_container =
|
||||||
$("<div/>",{
|
$('<div/>').
|
||||||
"class":'entity-container',
|
|
||||||
id: 'entity-container-' + entity.name
|
|
||||||
}).
|
|
||||||
append(facet_tabs()).
|
append(facet_tabs()).
|
||||||
append(content());
|
append(content());
|
||||||
return that.entity_container;
|
return that.entity_container;
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="navigation" class="tabs"></div>
|
<div id="navigation" class="tabs"></div>
|
||||||
|
<div id="content"></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ body{
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
width: 960px;
|
width: 960px;
|
||||||
|
background: url("centered-bg.png") no-repeat scroll 0 12.2em transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget {
|
.ui-widget {
|
||||||
@ -117,13 +118,15 @@ div.header span.header-loggedinas {
|
|||||||
|
|
||||||
/* ---- Navigation ---- */
|
/* ---- Navigation ---- */
|
||||||
div.tabs {
|
div.tabs {
|
||||||
overflow: auto;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 40em;
|
min-height: 4em;
|
||||||
background: url("centered-bg.png") no-repeat scroll 0 8.4em transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#content {
|
||||||
|
min-height: 35em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ul#viewtype {
|
ul#viewtype {
|
||||||
@ -370,7 +373,7 @@ span.attrhint {
|
|||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget-content .ui-icon {
|
.ui-icon {
|
||||||
//background-image: url("ui-icons_222222_256x240.png");
|
//background-image: url("ui-icons_222222_256x240.png");
|
||||||
background-color: #e2e2e2;
|
background-color: #e2e2e2;
|
||||||
}
|
}
|
||||||
@ -383,7 +386,7 @@ span.attrhint {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget-content a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #1d85d5;
|
color: #1d85d5;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
@ -421,7 +424,7 @@ span.attrhint {
|
|||||||
margin-right: .1em;
|
margin-right: .1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
|
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, #content .ui-state-default {
|
||||||
-moz-border-radius: .3em;
|
-moz-border-radius: .3em;
|
||||||
-webkit-border-radius: .3em;
|
-webkit-border-radius: .3em;
|
||||||
background: -moz-linear-gradient(top, #959595, #5e5e5e);
|
background: -moz-linear-gradient(top, #959595, #5e5e5e);
|
||||||
@ -509,6 +512,11 @@ span.ui-icon-search {
|
|||||||
background-image: url("Subnav-background.png");
|
background-image: url("Subnav-background.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabs3 .ui-tabs-nav {
|
||||||
|
padding: 1em 2em 0.1em 2em;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.tabs2 .ui-tabs-nav li {
|
.tabs2 .ui-tabs-nav li {
|
||||||
width:auto;
|
width:auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -811,9 +819,7 @@ table.scrollable tbody {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.entity-header {
|
div.entity-header {
|
||||||
width:100%px;
|
padding: 0px 20px 10px;
|
||||||
padding:10px;
|
|
||||||
margin:10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ IPA.navigation = function(spec) {
|
|||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
that.container = spec.container;
|
that.container = spec.container;
|
||||||
|
that.content = spec.content;
|
||||||
that.tab_class = spec.tab_class || 'tabs';
|
that.tab_class = spec.tab_class || 'tabs';
|
||||||
|
|
||||||
that.tabs = [];
|
that.tabs = [];
|
||||||
@ -116,7 +117,7 @@ IPA.navigation = function(spec) {
|
|||||||
tabs.tabs({
|
tabs.tabs({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
var panel = $(ui.panel);
|
var panel = $(ui.panel);
|
||||||
var name = panel.attr('id');
|
var name = panel.attr('name');
|
||||||
|
|
||||||
return that.show_page(name);
|
return that.show_page(name);
|
||||||
}
|
}
|
||||||
@ -128,11 +129,13 @@ IPA.navigation = function(spec) {
|
|||||||
container.addClass(that.tab_class);
|
container.addClass(that.tab_class);
|
||||||
container.addClass('tabs'+depth);
|
container.addClass('tabs'+depth);
|
||||||
|
|
||||||
|
var parent_id = container.attr('id');
|
||||||
|
|
||||||
var ul = $('<ul/>').appendTo(container);
|
var ul = $('<ul/>').appendTo(container);
|
||||||
|
|
||||||
for (var i=0; i<tabs.length; i++) {
|
for (var i=0; i<tabs.length; i++) {
|
||||||
var tab = tabs[i];
|
var tab = tabs[i];
|
||||||
|
var tab_id = parent_id+'-'+i;
|
||||||
var label = tab.name;
|
var label = tab.name;
|
||||||
if (tab.entity) {
|
if (tab.entity) {
|
||||||
var entity = IPA.get_entity(tab.entity);
|
var entity = IPA.get_entity(tab.entity);
|
||||||
@ -149,32 +152,37 @@ IPA.navigation = function(spec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('<li/>').append($('<a/>', {
|
$('<li/>').append($('<a/>', {
|
||||||
href: '#'+tab.name,
|
href: '#'+tab_id,
|
||||||
title: tab.name,
|
title: label,
|
||||||
html: label
|
html: label
|
||||||
})).appendTo(ul);
|
})).appendTo(ul);
|
||||||
|
|
||||||
tab.content = $('<div/>', {
|
tab.container = $('<div/>', {
|
||||||
id: tab.name
|
id: tab_id,
|
||||||
|
name: tab.name
|
||||||
}).appendTo(container);
|
}).appendTo(container);
|
||||||
|
|
||||||
if (tab.entity) {
|
|
||||||
tab.content.addClass('entity-container');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tab.children && tab.children.length) {
|
if (tab.children && tab.children.length) {
|
||||||
that._create(tab.children, tab.content, depth+1);
|
that._create(tab.children, tab.container, depth+1);
|
||||||
|
|
||||||
|
} else if (tab.entity) {
|
||||||
|
tab.content = $('<div/>', {
|
||||||
|
name: tab.name,
|
||||||
|
title: label,
|
||||||
|
'class': 'entity-container'
|
||||||
|
}).appendTo(that.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.update = function() {
|
that.update = function() {
|
||||||
|
$('.entity-container', that.content).css('display', 'none');
|
||||||
that._update(that.tabs, that.container, 1);
|
that._update(that.tabs, that.container, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
that._update = function(tabs, container, depth) {
|
that._update = function(tabs, container, depth) {
|
||||||
|
|
||||||
var parent_name = container.attr('id');
|
var parent_name = container.attr('name') || container.attr('id');
|
||||||
var tab_name = that.get_state(parent_name);
|
var tab_name = that.get_state(parent_name);
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
@ -186,9 +194,10 @@ IPA.navigation = function(spec) {
|
|||||||
var tab = tabs[index];
|
var tab = tabs[index];
|
||||||
|
|
||||||
if (tab.children && tab.children.length) {
|
if (tab.children && tab.children.length) {
|
||||||
that._update(tab.children, tab.content, depth+1);
|
that._update(tab.children, tab.container, depth+1);
|
||||||
|
|
||||||
} else if (tab.entity) {
|
} else if (tab.entity) {
|
||||||
|
$('.entity-container[name="'+tab.entity.name+'"]', that.content).css('display', 'inline');
|
||||||
tab.entity.setup(tab.content);
|
tab.entity.setup(tab.content);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -43,8 +43,8 @@ test("Testing IPA.navigation.create().", function() {
|
|||||||
metadata:IPA.metadata.objects.user});
|
metadata:IPA.metadata.objects.user});
|
||||||
that.setup = function(container){
|
that.setup = function(container){
|
||||||
user_mock_called = true;
|
user_mock_called = true;
|
||||||
same(container[0].id,'user','user id');
|
same(container.attr('name'), 'user', 'user container name');
|
||||||
same(container[0].nodeName,'DIV','user div');
|
same(container[0].nodeName, 'DIV', 'user container element');
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
@ -53,8 +53,8 @@ test("Testing IPA.navigation.create().", function() {
|
|||||||
metadata:IPA.metadata.objects.group});
|
metadata:IPA.metadata.objects.group});
|
||||||
that.setup = function(container){
|
that.setup = function(container){
|
||||||
group_mock_called = true;
|
group_mock_called = true;
|
||||||
same(container[0].id,'group','group id');
|
same(container.attr('name'), 'group','user container name');
|
||||||
same(container[0].nodeName,'DIV','group Div');
|
same(container[0].nodeName, 'DIV', 'user container element');
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
@ -62,12 +62,14 @@ test("Testing IPA.navigation.create().", function() {
|
|||||||
IPA.start_entities();
|
IPA.start_entities();
|
||||||
|
|
||||||
IPA.metadata = {};
|
IPA.metadata = {};
|
||||||
var container = $('<div id="navigation"/>').appendTo(document.body);
|
var navigation_container = $('<div id="navigation"/>').appendTo(document.body);
|
||||||
|
var entity_container = $('<div id="content"/>').appendTo(document.body);
|
||||||
var user_mock_called = false;
|
var user_mock_called = false;
|
||||||
var group_mock_called = false;
|
var group_mock_called = false;
|
||||||
|
|
||||||
var navigation = IPA.navigation({
|
var navigation = IPA.navigation({
|
||||||
container: container,
|
container: navigation_container,
|
||||||
|
content: entity_container,
|
||||||
tabs: [
|
tabs: [
|
||||||
{ name:'identity', label:'IDENTITY', children: [
|
{ name:'identity', label:'IDENTITY', children: [
|
||||||
{name:'user', entity:'user'},
|
{name:'user', entity:'user'},
|
||||||
@ -81,19 +83,34 @@ test("Testing IPA.navigation.create().", function() {
|
|||||||
|
|
||||||
ok(user_mock_called, "mock user setup was called");
|
ok(user_mock_called, "mock user setup was called");
|
||||||
ok(!group_mock_called, "mock group setup was not called because the tab is inactive");
|
ok(!group_mock_called, "mock group setup was not called because the tab is inactive");
|
||||||
same( container[0].children.length, 2, "Two Child tabs");
|
|
||||||
same( container[0].children[1].id, 'identity', "Identity Tab");
|
var level1_tabs = navigation_container.children('div');
|
||||||
same( container[0].children[1].children[1].id, 'user', "User Tab");
|
same(level1_tabs.length, 1, "One level 1 tab");
|
||||||
same( container[0].children[1].children[2].id, 'group', "User Tab");
|
|
||||||
container.remove();
|
var identity_tab = level1_tabs.first();
|
||||||
|
same(identity_tab.attr('name'), 'identity', "Identity Tab");
|
||||||
|
|
||||||
|
var level2_tabs = identity_tab.children('div');
|
||||||
|
same(level2_tabs.length, 2, "Two level 2 tabs");
|
||||||
|
|
||||||
|
var user_tab = level2_tabs.first();
|
||||||
|
same(user_tab.attr('name'), 'user', "User Tab");
|
||||||
|
|
||||||
|
var group_tab = user_tab.next();
|
||||||
|
same(group_tab.attr('name'), 'group', "Group Tab");
|
||||||
|
|
||||||
|
entity_container.remove();
|
||||||
|
navigation_container.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Testing IPA.navigation.update() with valid index.", function() {
|
test("Testing IPA.navigation.update() with valid index.", function() {
|
||||||
|
|
||||||
var container = $('<div id="navigation"/>').appendTo(document.body);
|
var navigation_container = $('<div id="navigation"/>').appendTo(document.body);
|
||||||
|
var entity_container = $('<div id="content"/>').appendTo(document.body);
|
||||||
|
|
||||||
var navigation = IPA.navigation({
|
var navigation = IPA.navigation({
|
||||||
container: container,
|
container: navigation_container,
|
||||||
|
content: entity_container,
|
||||||
tabs: [
|
tabs: [
|
||||||
{ name:'identity', label:'IDENTITY', children: [
|
{ name:'identity', label:'IDENTITY', children: [
|
||||||
{name:'one', label:'One', setup: function (){}},
|
{name:'one', label:'One', setup: function (){}},
|
||||||
@ -121,26 +138,29 @@ test("Testing IPA.navigation.update() with valid index.", function() {
|
|||||||
navigation.update();
|
navigation.update();
|
||||||
|
|
||||||
same(
|
same(
|
||||||
container.tabs('option', 'selected'), 0,
|
navigation_container.tabs('option', 'selected'), 0,
|
||||||
"Active tab at level 1"
|
"Active tab at level 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
same(
|
same(
|
||||||
$('#identity').tabs('option', 'selected'), 1,
|
$('.tabs[name=identity]', navigation_container).tabs('option', 'selected'), 1,
|
||||||
"Active tab at level 2"
|
"Active tab at level 2"
|
||||||
);
|
);
|
||||||
|
|
||||||
navigation.remove_state("identity");
|
navigation.remove_state("identity");
|
||||||
|
|
||||||
container.remove();
|
entity_container.remove();
|
||||||
|
navigation_container.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Testing IPA.navigation.update() with out-of-range index.", function() {
|
test("Testing IPA.navigation.update() with out-of-range index.", function() {
|
||||||
|
|
||||||
var container = $('<div id="navigation"/>').appendTo(document.body);
|
var navigation_container = $('<div id="navigation"/>').appendTo(document.body);
|
||||||
|
var entity_container = $('<div id="content"/>').appendTo(document.body);
|
||||||
|
|
||||||
var navigation = IPA.navigation({
|
var navigation = IPA.navigation({
|
||||||
container: container,
|
container: navigation_container,
|
||||||
|
content: entity_container,
|
||||||
tabs: [
|
tabs: [
|
||||||
{ name:'identity', label:'IDENTITY', children: [
|
{ name:'identity', label:'IDENTITY', children: [
|
||||||
{name:'one', label:'One', setup: function (){}},
|
{name:'one', label:'One', setup: function (){}},
|
||||||
@ -168,16 +188,17 @@ test("Testing IPA.navigation.update() with out-of-range index.", function() {
|
|||||||
navigation.update();
|
navigation.update();
|
||||||
|
|
||||||
same(
|
same(
|
||||||
container.tabs('option', 'selected'), 0,
|
navigation_container.tabs('option', 'selected'), 0,
|
||||||
"Active tab at level 1"
|
"Active tab at level 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
same(
|
same(
|
||||||
$('#identity').tabs('option', 'selected'), 0,
|
$('.tabs[name=identity]', navigation_container).tabs('option', 'selected'), 0,
|
||||||
"Active tab at level 2"
|
"Active tab at level 2"
|
||||||
);
|
);
|
||||||
|
|
||||||
navigation.remove_state("identity");
|
navigation.remove_state("identity");
|
||||||
|
|
||||||
container.remove();
|
entity_container.remove();
|
||||||
|
navigation_container.remove();
|
||||||
});
|
});
|
||||||
|
@ -128,7 +128,8 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return factory({
|
return factory({
|
||||||
container: $('#navigation')
|
container: $('#navigation'),
|
||||||
|
content: $('#content')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +154,7 @@ $(function() {
|
|||||||
|
|
||||||
|
|
||||||
function init_on_error(xhr, text_status, error_thrown) {
|
function init_on_error(xhr, text_status, error_thrown) {
|
||||||
var container = $('#navigation').empty();
|
var container = $('#content').empty();
|
||||||
container.append('<p>Error: '+error_thrown.name+'</p>');
|
container.append('<p>Error: '+error_thrown.name+'</p>');
|
||||||
container.append('<p>'+error_thrown.title+'</p>');
|
container.append('<p>'+error_thrown.title+'</p>');
|
||||||
container.append('<p>'+error_thrown.message+'</p>');
|
container.append('<p>'+error_thrown.message+'</p>');
|
||||||
|
Loading…
Reference in New Issue
Block a user