improve sonia.navigation

This commit is contained in:
Sebastian Sdorra
2010-12-05 16:27:31 +01:00
parent 2dc419fcaa
commit 5b447ec29c
3 changed files with 23 additions and 2 deletions

View File

@@ -30,7 +30,9 @@
*/
loginCallbacks.push(function(){
if (admin){
Ext.getCmp('navigationPanel').addSection({
var navPanel = Ext.getCmp('navigationPanel');
var count = navPanel.count() - 1;
navPanel.insertSection(count, {
title: 'Development',
items: [{
label: 'Injection Graph',

View File

@@ -120,6 +120,18 @@ Sonia.navigation.NavPanel = Ext.extend(Ext.Panel, {
}
},
insertSection: function(pos, section){
if ( debug ){
console.debug('insert navsection ' + section.title + ' at ' + pos);
}
this.insert(pos,{
xtype: 'navSection',
title: section.title,
data: section.items
});
this.doLayout();
},
addSections: function(sections){
if ( Ext.isArray( sections ) && sections.length > 0 ){
for ( var i=0; i<sections.length; i++ ){
@@ -132,11 +144,18 @@ Sonia.navigation.NavPanel = Ext.extend(Ext.Panel, {
},
addSection: function(section){
if ( debug ){
console.debug('add navsection ' + section.title);
}
this.add({
xtype: 'navSection',
title: section.title,
data: section.items
});
},
count: function(){
return this.items.length;
}
});

View File

@@ -179,7 +179,7 @@ Ext.onReady(function(){
// register login callbacks
// create menu
loginCallbacks.push( createMainMenu );
loginCallbacks.splice(0, 0, createMainMenu );
// add welcome tab
loginCallbacks.push( createWelcomePanel );