mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-18 21:42:10 +01:00
#828 focus same repository as was selected previously
This commit is contained in:
@@ -482,8 +482,34 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
listener.call(listener.scope, item, panels);
|
||||
}
|
||||
});
|
||||
|
||||
// get the xtype of the currently opened tab
|
||||
// search for the tab with the same xtype and activate it
|
||||
// see issue https://goo.gl/3RGnA3
|
||||
var activeTab = 0;
|
||||
var activeXtype = this.getActiveTabXtype();
|
||||
if (activeXtype){
|
||||
for (var i=0; i<panels.length; i++){
|
||||
if (panels[i].xtype === activeXtype){
|
||||
activeTab = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sonia.repository.setEditPanel(panels);
|
||||
Sonia.repository.setEditPanel(panels, activeTab);
|
||||
},
|
||||
|
||||
getActiveTabXtype: function(){
|
||||
var type = null;
|
||||
var rep = Ext.getCmp('repositoryEditPanel');
|
||||
if (rep){
|
||||
var at = rep.getActiveTab();
|
||||
if (at && at.xtype){
|
||||
type = at.xtype;
|
||||
}
|
||||
}
|
||||
return type;
|
||||
},
|
||||
|
||||
renderRepositoryType: function(repositoryType){
|
||||
|
||||
@@ -74,13 +74,18 @@ Sonia.repository.isOwner = function(repository){
|
||||
return admin || repository.permissions;
|
||||
};
|
||||
|
||||
Sonia.repository.setEditPanel = function(panels){
|
||||
Sonia.repository.setEditPanel = function(panels, activeTab){
|
||||
var editPanel = Ext.getCmp('repositoryEditPanel');
|
||||
editPanel.removeAll();
|
||||
Ext.each(panels, function(panel){
|
||||
editPanel.add(panel);
|
||||
});
|
||||
editPanel.setActiveTab(0);
|
||||
|
||||
if (!activeTab){
|
||||
activeTab = 0;
|
||||
}
|
||||
|
||||
editPanel.setActiveTab(activeTab);
|
||||
editPanel.doLayout();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user