From 94d8d9f2bfe6f085deb1854f6f1808998486f8db Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 27 Oct 2012 13:04:30 +0200 Subject: [PATCH] added repository type icons to grid --- .../main/resources/sonia/scm/git.config.js | 6 +++-- .../src/main/resources/sonia/scm/hg.config.js | 4 +++ .../main/resources/sonia/scm/svn.config.js | 4 +++ .../resources/images/icons/16x16/git.png | Bin 0 -> 917 bytes .../images/icons/16x16/mercurial.png | Bin 0 -> 762 bytes .../images/icons/16x16/subversion.png | Bin 0 -> 886 bytes .../js/repository/sonia.repository.grid.js | 25 +++++++++++++++++- .../js/repository/sonia.repository.js | 6 +++++ 8 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 scm-webapp/src/main/webapp/resources/images/icons/16x16/git.png create mode 100644 scm-webapp/src/main/webapp/resources/images/icons/16x16/mercurial.png create mode 100644 scm-webapp/src/main/webapp/resources/images/icons/16x16/subversion.png 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 0000000000000000000000000000000000000000..4068f47375fcf41324696422838b39504684dc51 GIT binary patch literal 917 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstUx|vage(c z!@6@aFM%9|WRD45bDP46hOx7_4S6Fo+k-*%fF5)Ta>O z6XFU~@U5@+ecyX&|2nbnTYt?5UxN?6K*8FddpCXX(R=Ty^WID6y^HGC z`ph45dp>yUeQC)4;H~>H&iO;IIS_qJaQ&1O1ZJB7*&pLwKc#qm47dIeVEiH245Tc` z>_d?0rv$f;k+vT~Ej|RAfJB1LKW7DfDNp_B=WY=PE+6oU-}n*Rx?7$j@|DaivQ4s;Ae zd$Q-(rd)_ifbIlY0aEM=Q~=TfQ5Ilq8U5ZL7)J3WL4KgX#{_y8F6s;KIHaj&SM~LX z#*w=|$?Lu!+Rx2@=!FAw(YJ#Wyu8b=|F|$Q=Z3b(?5tmrjO{n>Z+&;t>|?O?^V9kl zM7Z{T?QJ@3a8m!G+0mxdqd@Z+lf2zs4A$MzeFEfg7I;J!18EO1b~~AE2V`9Kba4!k zxSX88z~rVDXjsUpmc}NLFmXy(|MY2zsm%p9EmNL85q*bTuYW7Uq)~6T3%ikftetCXE28+kIRskY|tpT-ae1$$<3bq^H{ z3l)(g&jk|_5+1X5wY0id9CLU3$lWxDD^OToUQ$Da=Od5wYMu*EUPyGPz~JfX=d#Wzp$P!>0%)xO literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..f074d9b634beaf2dd9106562bdb8efc08115dbc1 GIT binary patch literal 762 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpafHr zx4R3&|Mvbf`++>p0*}aIAngIhZYQ(tfJUG5ba4#PI3L>U>k-VzaJ>F~cKo(8TVKwK zUhA8~)65}xM(U!X%@x(wT_vvtDqcoiSlTR5D&Zol)Utq|>(_yp3kR)Ir|-<#IwNA* zr7e+W&!h9t|2$SLd(E-mzV5%hJtITWlb3JT&b`XsYcTE8RnvWc{Z>vVz$YQ8^3d= z^H;buygyU+cWeH&wX?Ge5ntu1`)cN<@Em+ri~F!uU<&-O{~`PIp#3a3QghqKIZ;anGYiT#P?_ZPRmXdcVs zQkE{caMrX+?MbwbXRi3_=R8yXs(wGS;nIfp8y}{N_iw!V?XLJ~o$9QWYC?k79?h>k z<>>#(;BSqhcg`Ml<$nt*ch(6*a1lZW#u8_MiC{{9NAIdz~@o z?5_uaQLI|x8c~vxSdwa$T$Bo=7>o=IjdTqSbdAhI42`UeEv<}Av<-}`3=9IEnVX?# z$jwj5OsmALL2-9~7f^#F$cEtjw370~qErUQl>DSr1<%~X^wgl##FWaylc}II$l&Sf K=d#Wzp$Pz1NH$0S literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..93775f3971faecd6bea70d91e6ab251a1953aa60 GIT binary patch literal 886 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstUx|vage(c z!@6@aFM%9|WRD45bDP46hOx7_4S6Fo+k-*%fF5)aMo8 z6XM!1=S0)olTGtZR?j$AI{9$<)FZ76PA%GY{n+Ja&)Y9tYPd$3@{L_!0e}4b@`{u*C&OI@I%hl7@Uw;1j>;M1%A3py$d*kJb-8Z|J zo~@aAY~JRpr>?#D_T%^a&p!^Fdr~^(aK*Hv&GSx9SaE*O=|{I7y|0*hqCc~k`_Da|y!yh7^_LfJySDDYo!zG% zp1k_v`h#~*Uw!%T<>&9;fB*jb2gIMg{(SNF>)odxuHJil{?@C@ci(*c^7G%n|M#DL zymBk`seSz6IWfBw)WEN_uqD% zeAu(}?92_94_$cr?&J5b-+wpHKehSDy=(X1zWwxl&c-VbpMU!D?bpqR@5-hezV-P1 z&Jzz?N)-};!OfWD?d~E~n*PKH$l)yTh%5%u9$@TtGTRQw`0DB67$R}mwm;JRaDaqs ze|797mG5k8A2?rL)Vz@6qC|GaSyPj?RgqWD{I9?ID(c(m$lsakng3iocHp+F`*N|& zS?73ywN|g*tuFPt^=tyy-u3kjZ0&82V-5*=sJLg8oGA**T$(;XwqMX!<;s$zV4dX_ z%Q}^=omunx9B28x=o8H~QD<~?*RNS8dd=KyJIB$a&P8^Ao3H)2ZN0ntH+y@?v5Ona zilR8rJt!!wb5vDOcl{L4HAsSN2+mI{DNig)WpGT%PfAtr%uP&B4N6T+sVqF13Nn?!)78&qol`;+0Dr5@ A761SM literal 0 HcmV?d00001 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;