mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-09 16:47:19 +02:00
added history functions to repositorybrowser
This commit is contained in:
@@ -125,7 +125,7 @@ Sonia.repository.ChangesetViewerGrid = Ext.extend(Ext.grid.GridPanel, {
|
||||
|
||||
openRepositoryBrowser: function(revision){
|
||||
main.addTab({
|
||||
id: 'repositorybrowser-' + this.repository.id + '-' + revision,
|
||||
id: 'repositorybrowser-' + this.repository.id + ':' + revision,
|
||||
xtype: 'repositoryBrowser',
|
||||
repository: this.repository,
|
||||
revision: revision,
|
||||
|
||||
@@ -96,7 +96,7 @@ Sonia.repository.ExtendedInfoPanel = Ext.extend(Sonia.repository.InfoPanel,{
|
||||
|
||||
createRepositoryBrowser: function(){
|
||||
return {
|
||||
id: 'repositorybrowser-' + this.item.id,
|
||||
id: 'repositorybrowser-' + this.item.id + ':_',
|
||||
xtype: 'repositoryBrowser',
|
||||
repository: this.item,
|
||||
closable: true
|
||||
|
||||
@@ -50,6 +50,12 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
||||
console.debug('create new browser for repository ' + this.repository.name + " and revision " + this.revision);
|
||||
}
|
||||
|
||||
this.historyId = Sonia.History.createToken([
|
||||
'repositorybrowser',
|
||||
this.repository.id,
|
||||
this.revision ? this.revision : '_'
|
||||
]);
|
||||
|
||||
var browserStore = new Sonia.rest.JsonStore({
|
||||
proxy: new Ext.data.HttpProxy({
|
||||
url: restUrl + 'repositories/' + this.repository.id + '/browse.json',
|
||||
@@ -162,6 +168,22 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
||||
length: 0
|
||||
}));
|
||||
}
|
||||
|
||||
var historyParams = [];
|
||||
if ( this.revision ){
|
||||
historyParams.push(this.revision)
|
||||
} else {
|
||||
historyParams.push('_');
|
||||
}
|
||||
|
||||
if ( extra.params.path ){
|
||||
historyParams.push(extra.params.path);
|
||||
}
|
||||
|
||||
var id = Sonia.History.appendWithDepth(historyParams, 2);
|
||||
if (id){
|
||||
this.historyId = id;
|
||||
}
|
||||
},
|
||||
|
||||
onClick: function(e){
|
||||
@@ -313,3 +335,26 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
||||
|
||||
// register xtype
|
||||
Ext.reg('repositoryBrowser', Sonia.repository.RepositoryBrowser);
|
||||
|
||||
// register history handler
|
||||
Sonia.History.register('repositorybrowser', function(params){
|
||||
|
||||
if (params){
|
||||
|
||||
var id = 'repositorybrowser-' + params[0] + ':';
|
||||
var revision = params[1];
|
||||
id += revision;
|
||||
var path = params[2] ? params[2] : '';
|
||||
|
||||
if (debug){
|
||||
console.debug('load repositorybrowser for ' + id + ', ' + revision + ', ' + path );
|
||||
}
|
||||
|
||||
var tab = Ext.getCmp(id);
|
||||
|
||||
if ( tab ){
|
||||
main.getMainTabPanel().setActiveTab(id);
|
||||
tab.changeDirectory(path);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user