From c9f1fc54993590663aa177ead7bfaa7a042ef85e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 26 Nov 2010 19:08:44 +0100 Subject: [PATCH] hide add repository button for non admin users --- .../webapp/resources/js/sonia.repository.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/sonia.repository.js index eb0a650528..bf469fe561 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.repository.js @@ -163,7 +163,7 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{ } var url = restUrl + 'repositories/' + item.id + '.json'; var el = this.el; - var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); + var tid = setTimeout( function(){el.mask('Loading ...');}, 100); Ext.Ajax.request({ url: url, jsonData: item, @@ -191,7 +191,7 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{ } var url = restUrl + 'repositories.json'; var el = this.el; - var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); + var tid = setTimeout( function(){el.mask('Loading ...');}, 100); Ext.Ajax.request({ url: url, jsonData: item, @@ -224,6 +224,18 @@ Sonia.repository.Panel = Ext.extend(Ext.Panel, { initComponent: function(){ + var toolbar = []; + if ( admin ){ + toolbar.push( + {xtype: 'tbbutton', text: 'Add', scope: this, handler: this.showAddForm} + ); + } + toolbar.push( + {xtype: 'tbbutton', text: 'Remove', scope: this, handler: this.removeRepository}, + '-', + {xtype: 'tbbutton', text: 'Reload', scope: this, handler: this.reload} + ); + var config = { layout: 'border', hideMode: 'offsets', @@ -231,12 +243,7 @@ Sonia.repository.Panel = Ext.extend(Ext.Panel, { enableTabScroll: true, region:'center', autoScroll: true, - tbar: [ - {xtype: 'tbbutton', text: 'Add', scope: this, handler: this.showAddForm}, - {xtype: 'tbbutton', text: 'Remove', scope: this, handler: this.removeRepository}, - '-', - {xtype: 'tbbutton', text: 'Reload', scope: this, handler: this.reload} - ], + tbar: toolbar, items: [{ id: 'repositoryGrid', xtype: 'repositoryGrid',