mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
added repository type icons to grid
This commit is contained in:
@@ -100,10 +100,12 @@ initCallbacks.push(function(main){
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// register panel
|
||||
|
||||
registerConfigPanel({
|
||||
xtype : 'gitConfigPanel'
|
||||
});
|
||||
|
||||
// register type icon
|
||||
|
||||
Sonia.repository.typeIcons['git'] = 'resources/images/icons/16x16/git.png';
|
||||
|
||||
@@ -241,3 +241,7 @@ registerConfigPanel({
|
||||
id: 'hgConfigForm',
|
||||
xtype : 'hgConfigPanel'
|
||||
});
|
||||
|
||||
// register type icon
|
||||
|
||||
Sonia.repository.typeIcons['hg'] = 'resources/images/icons/16x16/mercurial.png';
|
||||
|
||||
@@ -153,3 +153,7 @@ initCallbacks.push(function(main){
|
||||
registerConfigPanel({
|
||||
xtype : 'svnConfigPanel'
|
||||
});
|
||||
|
||||
// register type icon
|
||||
|
||||
Sonia.repository.typeIcons['svn'] = 'resources/images/icons/16x16/subversion.png';
|
||||
|
||||
BIN
scm-webapp/src/main/webapp/resources/images/icons/16x16/git.png
Normal file
BIN
scm-webapp/src/main/webapp/resources/images/icons/16x16/git.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 917 B |
Binary file not shown.
|
After Width: | Height: | Size: 762 B |
Binary file not shown.
|
After Width: | Height: | Size: 886 B |
@@ -30,6 +30,9 @@
|
||||
*/
|
||||
Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
|
||||
// templates
|
||||
typeIconTemplate: '<img src="{0}" alt="{1}" title="{2}">',
|
||||
|
||||
colNameText: 'Name',
|
||||
colTypeText: 'Type',
|
||||
colContactText: 'Contact',
|
||||
@@ -121,6 +124,11 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
width: 125
|
||||
},
|
||||
columns: [{
|
||||
id: 'iconType',
|
||||
dataIndex: 'type',
|
||||
renderer: this.renderTypeIcon,
|
||||
width: 20
|
||||
},{
|
||||
id: 'name',
|
||||
header: this.colNameText,
|
||||
dataIndex: 'name',
|
||||
@@ -131,7 +139,8 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
header: this.colTypeText,
|
||||
dataIndex: 'type',
|
||||
renderer: this.renderRepositoryType,
|
||||
width: 80
|
||||
width: 80,
|
||||
hidden: true
|
||||
},{
|
||||
id: 'contact',
|
||||
header: this.colContactText,
|
||||
@@ -220,6 +229,20 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
}
|
||||
},
|
||||
|
||||
renderTypeIcon: function(type){
|
||||
var result = '';
|
||||
var icon = Sonia.repository.getTypeIcon(type);
|
||||
if ( icon ){
|
||||
var displayName = type;
|
||||
var t = Sonia.repository.getTypeByName(type);
|
||||
if (t){
|
||||
displayName = t.displayName;
|
||||
}
|
||||
result = String.format(this.typeIconTemplate, icon, type, displayName);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
renderRepositoryUrl: function(name, meta, record){
|
||||
var type = record.get('type');
|
||||
return this.renderUrl(
|
||||
|
||||
@@ -45,8 +45,14 @@ Ext.ns('Sonia.repository');
|
||||
|
||||
Sonia.repository.openListeners = [];
|
||||
|
||||
Sonia.repository.typeIcons = [];
|
||||
|
||||
// functions
|
||||
|
||||
Sonia.repository.getTypeIcon = function(type){
|
||||
return Sonia.repository.typeIcons[type];
|
||||
}
|
||||
|
||||
Sonia.repository.createContentUrl = function(repository, path, revision){
|
||||
var contentUrl = restUrl + 'repositories/' + repository.id + '/';
|
||||
contentUrl += 'content?path=' + path;
|
||||
|
||||
Reference in New Issue
Block a user