public/javascripts/erp_app/desktop/applications/knitkit/module.js in knitkit-2.0.5 vs public/javascripts/erp_app/desktop/applications/knitkit/module.js in knitkit-2.0.6

- old
+ new

@@ -15,11 +15,12 @@ //Might get rid of this or make it an option you can select var title = 'KnitKit-' + currentUser.description //*********************************************************** var desktop = this.app.getDesktop(); var win = desktop.getWindow('knitkit'); - this.centerRegion = new Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion(); + var centerRegion = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion'); + this.centerRegion = centerRegion; if(!win){ win = desktop.createWindow({ id: 'knitkit', title:title, autoDestroy:true, @@ -29,9 +30,72 @@ iconCls: 'icon-palette', shim:false, animCollapse:false, constrainHeader:true, layout: 'border', + tbar:{ + items:[ + { + iconCls:'btn-save', + text:'Save', + handler:function(btn){ + centerRegion.saveCurrent(); + } + }, + { + iconCls:'btn-save-all', + text:'Save All', + handler:function(btn){ + centerRegion.saveAll(); + } + }, + '->', + { + iconCls:'btn-left-panel', + handler:function(btn){ + var panel = btn.up('window').down('knitkit_westregion'); + if(panel.collapsed){ + panel.expand(); + } + else{ + panel.collapse(Ext.Component.DIRECTION_LEFT); + } + } + }, + { + iconCls:'btn-right-panel', + handler:function(btn){ + var panel = btn.up('window').down('knitkit_eastregion'); + if(panel.collapsed){ + panel.expand(); + } + else{ + panel.collapse(Ext.Component.DIRECTION_RIGHT); + } + } + }, + { + iconCls:'btn-left-right-panel', + handler:function(btn){ + var east = btn.up('window').down('knitkit_eastregion'); + var west = btn.up('window').down('knitkit_westregion'); + if(west.collapsed || east.collapsed){ + west.expand(); + east.expand(); + } + else + if(!west.collapsed && !east.collapsed){ + var task = new Ext.util.DelayedTask(function(){ + west.collapse(Ext.Component.DIRECTION_LEFT); + }); + east.collapse(Ext.Component.DIRECTION_RIGHT); + task.delay(400); + + } + } + } + ] + }, items:[ this.centerRegion, { xtype:'knitkit_eastregion', module:this