mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
added repository type icons to grid
This commit is contained in:
@@ -100,10 +100,12 @@ initCallbacks.push(function(main){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// register panel
|
// register panel
|
||||||
|
|
||||||
registerConfigPanel({
|
registerConfigPanel({
|
||||||
xtype : 'gitConfigPanel'
|
xtype : 'gitConfigPanel'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// register type icon
|
||||||
|
|
||||||
|
Sonia.repository.typeIcons['git'] = 'resources/images/icons/16x16/git.png';
|
||||||
|
|||||||
@@ -241,3 +241,7 @@ registerConfigPanel({
|
|||||||
id: 'hgConfigForm',
|
id: 'hgConfigForm',
|
||||||
xtype : 'hgConfigPanel'
|
xtype : 'hgConfigPanel'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// register type icon
|
||||||
|
|
||||||
|
Sonia.repository.typeIcons['hg'] = 'resources/images/icons/16x16/mercurial.png';
|
||||||
|
|||||||
@@ -153,3 +153,7 @@ initCallbacks.push(function(main){
|
|||||||
registerConfigPanel({
|
registerConfigPanel({
|
||||||
xtype : 'svnConfigPanel'
|
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, {
|
Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||||
|
|
||||||
|
// templates
|
||||||
|
typeIconTemplate: '<img src="{0}" alt="{1}" title="{2}">',
|
||||||
|
|
||||||
colNameText: 'Name',
|
colNameText: 'Name',
|
||||||
colTypeText: 'Type',
|
colTypeText: 'Type',
|
||||||
colContactText: 'Contact',
|
colContactText: 'Contact',
|
||||||
@@ -121,6 +124,11 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
width: 125
|
width: 125
|
||||||
},
|
},
|
||||||
columns: [{
|
columns: [{
|
||||||
|
id: 'iconType',
|
||||||
|
dataIndex: 'type',
|
||||||
|
renderer: this.renderTypeIcon,
|
||||||
|
width: 20
|
||||||
|
},{
|
||||||
id: 'name',
|
id: 'name',
|
||||||
header: this.colNameText,
|
header: this.colNameText,
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
@@ -131,7 +139,8 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
header: this.colTypeText,
|
header: this.colTypeText,
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
renderer: this.renderRepositoryType,
|
renderer: this.renderRepositoryType,
|
||||||
width: 80
|
width: 80,
|
||||||
|
hidden: true
|
||||||
},{
|
},{
|
||||||
id: 'contact',
|
id: 'contact',
|
||||||
header: this.colContactText,
|
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){
|
renderRepositoryUrl: function(name, meta, record){
|
||||||
var type = record.get('type');
|
var type = record.get('type');
|
||||||
return this.renderUrl(
|
return this.renderUrl(
|
||||||
|
|||||||
@@ -45,8 +45,14 @@ Ext.ns('Sonia.repository');
|
|||||||
|
|
||||||
Sonia.repository.openListeners = [];
|
Sonia.repository.openListeners = [];
|
||||||
|
|
||||||
|
Sonia.repository.typeIcons = [];
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
|
||||||
|
Sonia.repository.getTypeIcon = function(type){
|
||||||
|
return Sonia.repository.typeIcons[type];
|
||||||
|
}
|
||||||
|
|
||||||
Sonia.repository.createContentUrl = function(repository, path, revision){
|
Sonia.repository.createContentUrl = function(repository, path, revision){
|
||||||
var contentUrl = restUrl + 'repositories/' + repository.id + '/';
|
var contentUrl = restUrl + 'repositories/' + repository.id + '/';
|
||||||
contentUrl += 'content?path=' + path;
|
contentUrl += 'content?path=' + path;
|
||||||
|
|||||||
Reference in New Issue
Block a user