added util method to open files

This commit is contained in:
Sebastian Sdorra
2015-06-13 21:33:22 +02:00
parent 69d95de054
commit c863151162
3 changed files with 26 additions and 39 deletions

View File

@@ -159,26 +159,8 @@ Sonia.repository.CommitPanel = Ext.extend(Ext.Panel, {
},
openFile: function(path){
if ( debug ){
console.debug( 'open file: ' + path );
}
var id = Sonia.repository.createContentId(
this.repository,
path,
this.revision
);
main.addTab({
id: id,
path: path,
revision: this.revision,
repository: this.repository,
xtype: 'contentPanel',
closable: true,
autoScroll: true
});
},
Sonia.repository.openFile(this.repository, path, this.revision);
}
});

View File

@@ -189,4 +189,27 @@ Sonia.repository.get = function(id, callback){
}
});
}
};
/** open file */
Sonia.repository.openFile = function(repository, path, revision){
if ( debug ){
console.debug( 'open file: ' + path );
}
var id = Sonia.repository.createContentId(
repository,
path,
revision
);
main.addTab({
id: id,
path: path,
revision: revision,
repository: repository,
xtype: 'contentPanel',
closable: true,
autoScroll: true
});
};

View File

@@ -339,25 +339,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
},
openFile: function(path){
if ( debug ){
console.debug( 'open file: ' + path );
}
var id = Sonia.repository.createContentId(
this.repository,
path,
this.revision
);
main.addTab({
id: id,
path: path,
revision: this.revision,
repository: this.repository,
xtype: 'contentPanel',
closable: true,
autoScroll: true
});
Sonia.repository.openFile(this.repository, path, this.revision);
},
changeDirectory: function(path){