mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-11 14:50:19 +01:00
handle history events for repository browser
This commit is contained in:
@@ -95,7 +95,7 @@ Sonia.repository.ExtendedInfoPanel = Ext.extend(Sonia.repository.InfoPanel,{
|
||||
|
||||
createRepositoryBrowser: function(){
|
||||
return {
|
||||
id: 'repositorybrowser-' + this.item.id + ':_',
|
||||
id: 'repositoryBrowser|' + this.item.id + '|null',
|
||||
xtype: 'repositoryBrowser',
|
||||
repository: this.item,
|
||||
closable: true
|
||||
|
||||
@@ -229,9 +229,22 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
||||
}
|
||||
});
|
||||
|
||||
this.path = path;
|
||||
this.updateHistory();
|
||||
|
||||
this.renderClickPath(path);
|
||||
},
|
||||
|
||||
updateHistory: function(){
|
||||
var token = Sonia.History.createToken(
|
||||
'repositoryBrowser',
|
||||
this.repository.id,
|
||||
this.revision,
|
||||
this.path
|
||||
);
|
||||
Sonia.History.add(token);
|
||||
},
|
||||
|
||||
createFolderButton: function(path, name){
|
||||
return {
|
||||
xtype: 'button',
|
||||
@@ -295,3 +308,46 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
||||
|
||||
// register xtype
|
||||
Ext.reg('repositoryBrowser', Sonia.repository.RepositoryBrowser);
|
||||
|
||||
|
||||
// register history handler
|
||||
Sonia.History.register('repositoryBrowser', {
|
||||
|
||||
onActivate: function(panel){
|
||||
return Sonia.History.createToken(
|
||||
'repositoryBrowser',
|
||||
panel.repository.id,
|
||||
panel.revision,
|
||||
panel.path
|
||||
);
|
||||
},
|
||||
|
||||
onChange: function(repoId, revision, path){
|
||||
if (revision == 'null'){
|
||||
revision = null;
|
||||
}
|
||||
if (path == 'null'){
|
||||
path = '';
|
||||
}
|
||||
var id = 'repositoryBrowser|' + repoId + "|" + revision;
|
||||
Sonia.repository.get(repoId, function(repository){
|
||||
var panel = Ext.getCmp(id);
|
||||
if (! panel){
|
||||
panel = {
|
||||
id: id,
|
||||
xtype: 'repositoryBrowser',
|
||||
repository : repository,
|
||||
revision: revision,
|
||||
closable: true,
|
||||
autoScroll: true
|
||||
}
|
||||
if (path){
|
||||
panel.path = path;
|
||||
}
|
||||
} else {
|
||||
panel.changeDirectory(path);
|
||||
}
|
||||
main.addTab(panel);
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user