diff --git a/scm-plugins/scm-git-plugin/src/main/resources/sonia/scm/git.config.js b/scm-plugins/scm-git-plugin/src/main/resources/sonia/scm/git.config.js index 8cf02780b8..fb7c96d273 100644 --- a/scm-plugins/scm-git-plugin/src/main/resources/sonia/scm/git.config.js +++ b/scm-plugins/scm-git-plugin/src/main/resources/sonia/scm/git.config.js @@ -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'; diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js index 65ce24a614..62549df4eb 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js @@ -241,3 +241,7 @@ registerConfigPanel({ id: 'hgConfigForm', xtype : 'hgConfigPanel' }); + +// register type icon + +Sonia.repository.typeIcons['hg'] = 'resources/images/icons/16x16/mercurial.png'; diff --git a/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js b/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js index 1359b71696..d8128453f6 100644 --- a/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js +++ b/scm-plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js @@ -153,3 +153,7 @@ initCallbacks.push(function(main){ registerConfigPanel({ xtype : 'svnConfigPanel' }); + +// register type icon + +Sonia.repository.typeIcons['svn'] = 'resources/images/icons/16x16/subversion.png'; diff --git a/scm-webapp/src/main/webapp/resources/images/icons/16x16/git.png b/scm-webapp/src/main/webapp/resources/images/icons/16x16/git.png new file mode 100644 index 0000000000..4068f47375 Binary files /dev/null and b/scm-webapp/src/main/webapp/resources/images/icons/16x16/git.png differ diff --git a/scm-webapp/src/main/webapp/resources/images/icons/16x16/mercurial.png b/scm-webapp/src/main/webapp/resources/images/icons/16x16/mercurial.png new file mode 100644 index 0000000000..f074d9b634 Binary files /dev/null and b/scm-webapp/src/main/webapp/resources/images/icons/16x16/mercurial.png differ diff --git a/scm-webapp/src/main/webapp/resources/images/icons/16x16/subversion.png b/scm-webapp/src/main/webapp/resources/images/icons/16x16/subversion.png new file mode 100644 index 0000000000..93775f3971 Binary files /dev/null and b/scm-webapp/src/main/webapp/resources/images/icons/16x16/subversion.png differ diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js index 2cfbb6f9c4..ba2ea3789a 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js @@ -30,6 +30,9 @@ */ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { + // templates + typeIconTemplate: '{1}', + 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( diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js index e8701ed28d..3660376b77 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js @@ -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;