mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-27 01:39:09 +01:00
toggle remove and archive button
This commit is contained in:
@@ -196,6 +196,8 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
groupTextTpl: '{group} ({[values.rs.length]} {[values.rs.length > 1 ? "Repositories" : "Repository"]})'
|
||||
})
|
||||
};
|
||||
|
||||
this.addEvents('repositorySelected');
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.repository.Grid.superclass.initComponent.apply(this, arguments);
|
||||
@@ -324,6 +326,9 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* TODO move to panel
|
||||
*/
|
||||
selectItem: function(item){
|
||||
if ( debug ){
|
||||
console.debug( item.name + ' selected' );
|
||||
@@ -332,14 +337,17 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
if ( this.parentPanel ){
|
||||
this.parentPanel.updateHistory(item);
|
||||
}
|
||||
|
||||
var owner = Sonia.repository.isOwner(item);
|
||||
|
||||
this.fireEvent('repositorySelected', item, owner);
|
||||
|
||||
var infoPanel = main.getInfoPanel(item.type);
|
||||
infoPanel.item = item;
|
||||
|
||||
var panels = [infoPanel];
|
||||
|
||||
if ( Sonia.repository.isOwner(item) ){
|
||||
Ext.getCmp('repoRmButton').setDisabled(false);
|
||||
if ( owner ){
|
||||
panels.push({
|
||||
item: item,
|
||||
xtype: 'repositorySettingsForm',
|
||||
|
||||
@@ -37,6 +37,7 @@ Sonia.repository.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
|
||||
// TODO i18n
|
||||
archiveText: 'Archive',
|
||||
unarchiveText: 'Unarchive',
|
||||
archiveTitleText: 'Archive Repository',
|
||||
archiveMsgText: 'Archive Repository "{0}"?',
|
||||
errorArchiveMsgText: 'Repository archival failed',
|
||||
@@ -83,7 +84,7 @@ Sonia.repository.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
toolbar.push({
|
||||
xtype: 'tbbutton',
|
||||
id: 'repoArchiveButton',
|
||||
disabled: false,
|
||||
disabled: true,
|
||||
text: this.archiveText,
|
||||
// TODO find icon
|
||||
icon: this.removeIcon,
|
||||
@@ -173,7 +174,13 @@ Sonia.repository.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
id: 'repositoryGrid',
|
||||
xtype: 'repositoryGrid',
|
||||
region: 'center',
|
||||
parentPanel: this
|
||||
parentPanel: this,
|
||||
listeners: {
|
||||
repositorySelected: {
|
||||
fn: this.onRepositorySelection,
|
||||
scope: this
|
||||
}
|
||||
}
|
||||
},{
|
||||
id: 'repositoryEditPanel',
|
||||
xtype: 'tabpanel',
|
||||
@@ -328,6 +335,29 @@ Sonia.repository.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
onRepositorySelection: function(item, owner){
|
||||
if ( owner ){
|
||||
if (state.clientConfig.enableRepositoryArchive){
|
||||
var archiveBt = Ext.getCmp('repoArchiveButton');
|
||||
if ( item.archived ){
|
||||
archiveBt.setText(this.unarchiveText);
|
||||
Ext.getCmp('repoRmButton').setDisabled(false);
|
||||
} else {
|
||||
archiveBt.setText(this.archiveText);
|
||||
Ext.getCmp('repoRmButton').setDisabled(true);
|
||||
}
|
||||
archiveBt.setDisabled(false);
|
||||
} else {
|
||||
Ext.getCmp('repoRmButton').setDisabled(false);
|
||||
}
|
||||
} else {
|
||||
Ext.getCmp('repoRmButton').setDisabled(false);
|
||||
if (state.clientConfig.enableRepositoryArchive){
|
||||
Ext.getCmp('repoArchiveButton').setDisabled(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
resetPanel: function(){
|
||||
Sonia.repository.setEditPanel(Sonia.repository.DefaultPanel);
|
||||
|
||||
Reference in New Issue
Block a user