mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
improve user interface
This commit is contained in:
150
scm-webapp/src/main/webapp/resources/js/sonia.scm.js
Normal file
150
scm-webapp/src/main/webapp/resources/js/sonia.scm.js
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.onReady(function(){
|
||||
|
||||
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||
|
||||
var mainTabPanel = new Ext.TabPanel({
|
||||
id: 'mainTabPanel',
|
||||
region: 'center',
|
||||
deferredRender: false
|
||||
});
|
||||
|
||||
new Ext.Viewport({
|
||||
layout: 'border',
|
||||
items: [
|
||||
new Ext.BoxComponent({
|
||||
region: 'north',
|
||||
id: 'north-panel',
|
||||
contentEl: 'north',
|
||||
height: 75
|
||||
}), {
|
||||
region: 'west',
|
||||
id: 'navigationPanel',
|
||||
title: 'Navigation',
|
||||
xtype: 'navPanel',
|
||||
split: true,
|
||||
width: 200,
|
||||
minSize: 175,
|
||||
maxSize: 400,
|
||||
collapsible: true,
|
||||
margins: '0 0 0 5'
|
||||
},
|
||||
new Ext.BoxComponent({
|
||||
region: 'south',
|
||||
id: 'south-panel',
|
||||
contentEl: 'south',
|
||||
height: 16,
|
||||
margins: '2 2 2 5'
|
||||
}),
|
||||
mainTabPanel
|
||||
]
|
||||
});
|
||||
|
||||
// check login
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'authentication.json',
|
||||
method: 'GET',
|
||||
success: function(response){
|
||||
if ( debug ){
|
||||
console.debug('login success');
|
||||
}
|
||||
var s = Ext.decode(response.responseText);
|
||||
loadState(s);
|
||||
},
|
||||
failure: function(){
|
||||
if ( debug ){
|
||||
console.debug('login failed');
|
||||
}
|
||||
var loginWin = new Sonia.login.Window();
|
||||
loginWin.show();
|
||||
}
|
||||
});
|
||||
|
||||
// methods called after login
|
||||
|
||||
function createMainMenu(){
|
||||
if ( debug ){
|
||||
console.debug('create main menu');
|
||||
}
|
||||
var panel = Ext.getCmp('navigationPanel');
|
||||
panel.addSections([{
|
||||
title: 'Main',
|
||||
items: [{
|
||||
label: 'Repositories',
|
||||
fn: function(){console.debug( 'Repositories' );}
|
||||
}]
|
||||
},{
|
||||
title: 'Config',
|
||||
items: [{
|
||||
label: 'General',
|
||||
fn: function(){console.debug( 'General Config' );}
|
||||
},{
|
||||
label: 'Repository Types',
|
||||
fn: function(){console.debug( 'RepositoryType Config' );}
|
||||
},{
|
||||
label: 'Server',
|
||||
fn: function(){console.debug( 'Server Config' );}
|
||||
}]
|
||||
},{
|
||||
title: 'Abmelden',
|
||||
items: [{
|
||||
label: 'Abmelden',
|
||||
fn: logout
|
||||
}]
|
||||
}]);
|
||||
}
|
||||
|
||||
function createWelcomePanel(){
|
||||
if ( debug ){
|
||||
console.debug('create welcome tab');
|
||||
}
|
||||
mainTabPanel.add({
|
||||
id: 'welcomeTab',
|
||||
xtype: 'panel',
|
||||
title: 'Welcome',
|
||||
hideMode: 'offsets',
|
||||
bodyCssClass: 'x-panel-mc',
|
||||
enableTabScroll: true,
|
||||
autoScroll: true
|
||||
});
|
||||
mainTabPanel.setActiveTab('welcomeTab');
|
||||
}
|
||||
|
||||
// register login callbacks
|
||||
|
||||
// create menu
|
||||
loginCallbacks.push( createMainMenu );
|
||||
// add welcome tab
|
||||
loginCallbacks.push( createWelcomePanel );
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user