mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
added back button to repositorybrowser
This commit is contained in:
@@ -51,7 +51,13 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
root: 'file.children',
|
root: 'file.children',
|
||||||
idProperty: 'path',
|
idProperty: 'path',
|
||||||
autoLoad: true,
|
autoLoad: true,
|
||||||
autoDestroy: true
|
autoDestroy: true,
|
||||||
|
listeners: {
|
||||||
|
load: {
|
||||||
|
fn: this.loadStore,
|
||||||
|
scope: this
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var browserColModel = new Ext.grid.ColumnModel({
|
var browserColModel = new Ext.grid.ColumnModel({
|
||||||
@@ -107,9 +113,43 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
Sonia.repository.RepositoryBrowser.superclass.initComponent.apply(this, arguments);
|
Sonia.repository.RepositoryBrowser.superclass.initComponent.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
loadStore: function(store, records, extra){
|
||||||
|
var path = extra.params.path;
|
||||||
|
if ( path != null && path.length > 0 ){
|
||||||
|
|
||||||
|
var index = path.lastIndexOf('/');
|
||||||
|
if ( index > 0 ){
|
||||||
|
path = path.substr(0, index);
|
||||||
|
} else {
|
||||||
|
path = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
var File = Ext.data.Record.create([{
|
||||||
|
name: 'name'
|
||||||
|
},{
|
||||||
|
name: 'path'
|
||||||
|
},{
|
||||||
|
name: 'directory'
|
||||||
|
},{
|
||||||
|
name: 'length'
|
||||||
|
},{
|
||||||
|
name: 'lastModified'
|
||||||
|
}]);
|
||||||
|
|
||||||
|
store.insert(0, new File({
|
||||||
|
name: '..',
|
||||||
|
path: path,
|
||||||
|
directory: true,
|
||||||
|
length: 0
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onClick: function(e){
|
onClick: function(e){
|
||||||
var el = e.getTarget('.scm-browser');
|
var el = e.getTarget('.scm-browser');
|
||||||
|
|
||||||
|
if ( el != null ){
|
||||||
|
|
||||||
var rel = el.rel.split(':');
|
var rel = el.rel.split(':');
|
||||||
var path = rel[1];
|
var path = rel[1];
|
||||||
|
|
||||||
@@ -118,6 +158,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
} else {
|
} else {
|
||||||
this.openFile(path);
|
this.openFile(path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openFile: function(path){
|
openFile: function(path){
|
||||||
|
|||||||
Reference in New Issue
Block a user