From 9ac1d4723b6a91b6c2a0a07d6e5c329687106680 Mon Sep 17 00:00:00 2001 From: "Julia.Svinareva" Date: Tue, 16 Apr 2024 20:31:21 +0300 Subject: [PATCH] [common] Add default icon for plugins --- apps/common/main/lib/controller/Plugins.js | 44 +++++++++++++----- apps/common/main/lib/view/Plugins.js | 13 ++++-- .../toolbar/1.25x/big/btn-plugin-default.png | Bin 0 -> 384 bytes .../1.25x/btn-plugin-panel-default.png | Bin 0 -> 253 bytes .../toolbar/1.5x/big/btn-plugin-default.png | Bin 0 -> 316 bytes .../toolbar/1.5x/btn-plugin-panel-default.png | Bin 0 -> 311 bytes .../toolbar/1.75x/big/btn-plugin-default.png | Bin 0 -> 399 bytes .../1.75x/btn-plugin-panel-default.png | Bin 0 -> 384 bytes .../img/toolbar/1x/big/btn-plugin-default.png | Bin 0 -> 326 bytes .../toolbar/1x/btn-plugin-panel-default.png | Bin 0 -> 229 bytes .../toolbar/2.5x/big/btn-plugin-default.svg | 6 +++ .../toolbar/2.5x/btn-plugin-panel-default.svg | 6 +++ .../img/toolbar/2x/big/btn-plugin-default.png | Bin 0 -> 435 bytes .../toolbar/2x/btn-plugin-panel-default.png | Bin 0 -> 367 bytes 14 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 apps/common/main/resources/img/toolbar/1.25x/big/btn-plugin-default.png create mode 100644 apps/common/main/resources/img/toolbar/1.25x/btn-plugin-panel-default.png create mode 100644 apps/common/main/resources/img/toolbar/1.5x/big/btn-plugin-default.png create mode 100644 apps/common/main/resources/img/toolbar/1.5x/btn-plugin-panel-default.png create mode 100644 apps/common/main/resources/img/toolbar/1.75x/big/btn-plugin-default.png create mode 100644 apps/common/main/resources/img/toolbar/1.75x/btn-plugin-panel-default.png create mode 100644 apps/common/main/resources/img/toolbar/1x/big/btn-plugin-default.png create mode 100644 apps/common/main/resources/img/toolbar/1x/btn-plugin-panel-default.png create mode 100644 apps/common/main/resources/img/toolbar/2.5x/big/btn-plugin-default.svg create mode 100644 apps/common/main/resources/img/toolbar/2.5x/btn-plugin-panel-default.svg create mode 100644 apps/common/main/resources/img/toolbar/2x/big/btn-plugin-default.png create mode 100644 apps/common/main/resources/img/toolbar/2x/btn-plugin-panel-default.png diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index fcbde5ea8d..f891e3eae6 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -486,7 +486,7 @@ define([ storePlugins.each(function(item){ me.viewPlugins.updatePluginIcons(item); var guid = item.get('guid'); - if (me.viewPlugins.pluginPanels[guid]) { + if (me.viewPlugins.pluginPanels[guid] && item.get('parsedIcons')) { var menu = me.viewPlugins.pluginPanels[guid].menu === 'right' ? iconsInRightMenu : iconsInLeftMenu; menu.push({ guid: guid, @@ -496,13 +496,15 @@ define([ } }); for (var key in this.viewPlugins.customPluginPanels) { - var panel = this.viewPlugins.customPluginPanels[key], - menu = panel.menu === 'right' ? iconsInRightMenu : iconsInLeftMenu; - menu.push({ - guid: panel.frameId, - baseUrl: panel.baseUrl, - parsedIcons: this.viewPlugins.parseIcons(panel.icons) - }); + var panel = this.viewPlugins.customPluginPanels[key]; + if (panel.icons) { + var menu = panel.menu === 'right' ? iconsInRightMenu : iconsInLeftMenu; + menu.push({ + guid: panel.frameId, + baseUrl: panel.baseUrl, + parsedIcons: this.viewPlugins.parseIcons(panel.icons) + }); + } } if (iconsInLeftMenu.length > 0) { me.viewPlugins.fireEvent('pluginsleft:updateicons', [iconsInLeftMenu]); @@ -599,6 +601,12 @@ define([ model = this.viewPlugins.storePlugins.findWhere({guid: pluginGuid}), name = createUniqueName(plugin.get_Name('en')); model.set({menu: menu}); + var icon_url, icon_cls; + if (model.get('parsedIcons')) { + icon_url = model.get('baseUrl') + model.get('parsedIcons')['normal']; + } else { + icon_cls = 'icon toolbar__icon btn-plugin-panel-default'; + } var $button = $('
'), button = new Common.UI.Button({ parentEl: $button, @@ -606,7 +614,8 @@ define([ hint: langName, enableToggle: true, toggleGroup: menu === 'right' ? 'tabpanelbtnsGroup' : 'leftMenuGroup', - iconImg: model.get('baseUrl') + model.get('parsedIcons')['normal'], + iconCls: icon_cls, + iconImg: icon_url, onlyIcon: true, value: pluginGuid, type: 'plugin' @@ -861,11 +870,14 @@ define([ b.visible = (isEdit || b.isViewer !== false); }); + var icons = (typeof itemVar.icons === 'string' && itemVar.icons.indexOf('%') !== -1 || !itemVar.icons2) ? itemVar.icons : itemVar.icons2; + if (!icons) icons = ''; + model.set({ description: description, index: variationsArr.length, url: itemVar.url, - icons: (typeof itemVar.icons === 'string' && itemVar.icons.indexOf('%') !== -1 || !itemVar.icons2) ? itemVar.icons : itemVar.icons2, + icons: icons, buttons: itemVar.buttons, visible: visible, help: itemVar.help @@ -1201,16 +1213,23 @@ define([ var baseUrl = variation.baseUrl || ""; var model = this.viewPlugins.storePlugins.findWhere({guid: guid}); var icons = variation.icons; + var icon_url, icon_cls; if (model) { if ("" === baseUrl) baseUrl = model.get('baseUrl'); - if (!icons) + if (!icons) { + var modes = model.get('variations'); icons = modes[model.get('currentVariation')].get('icons'); + } } - var parsedIcons = this.viewPlugins.parseIcons(icons), + if (!icons) { + icon_cls = 'icon toolbar__icon btn-plugin-panel-default'; + } else { + var parsedIcons = this.viewPlugins.parseIcons(icons); icon_url = baseUrl + parsedIcons['normal']; + } var $button = $('
'), button = new Common.UI.Button({ @@ -1219,6 +1238,7 @@ define([ hint: description, enableToggle: true, toggleGroup: menu === 'right' ? 'tabpanelbtnsGroup' : 'leftMenuGroup', + iconCls: icon_cls, iconImg: icon_url, onlyIcon: true, value: frameId, diff --git a/apps/common/main/lib/view/Plugins.js b/apps/common/main/lib/view/Plugins.js index 2ba3ee3803..be2d6138a7 100644 --- a/apps/common/main/lib/view/Plugins.js +++ b/apps/common/main/lib/view/Plugins.js @@ -399,12 +399,13 @@ define([ var modes = model.get('variations'), icons = modes[model.get('currentVariation')].get('icons'); + if (icons === '') return; model.set('parsedIcons', this.parseIcons(icons)); this.updatePluginButton(model); }, updatePluginButton: function(model) { - if (!model.get('visible')) + if (!model.get('visible') || !model.get('parsedIcons')) return null; var btn = model.get('button'), @@ -452,9 +453,14 @@ define([ var modes = model.get('variations'), guid = model.get('guid'), icons = modes[model.get('currentVariation')].get('icons'), - parsedIcons = this.parseIcons(icons), + icon_cls, icon_url; + if (icons === '') { + icon_cls = 'toolbar__icon btn-plugin-default' + } else { + var parsedIcons = this.parseIcons(icons); icon_url = model.get('baseUrl') + parsedIcons['normal']; - model.set('parsedIcons', parsedIcons); + model.set('parsedIcons', parsedIcons); + } var _menu_items = []; _.each(model.get('variations'), function(variation, index) { if (variation.get('visible')) @@ -468,6 +474,7 @@ define([ var _set = Common.enumLock; var btn = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', + iconCls: icon_cls, iconImg: icon_url, caption: model.get('name'), menu: _menu_items.length > 1, diff --git a/apps/common/main/resources/img/toolbar/1.25x/big/btn-plugin-default.png b/apps/common/main/resources/img/toolbar/1.25x/big/btn-plugin-default.png new file mode 100644 index 0000000000000000000000000000000000000000..351b6282d988b97b7e17bf8fd2c53ba6bb64bec9 GIT binary patch literal 384 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!3-qjPWHqDDUSf35LY1m|NnnD31L7)klDy0 zaB*afo14s50VTvrg8YIR?%!8Xs9#XOV17e>{`vFUCrsGCJ|V&H$)O^kii@5ujv*e$ z-(J4Wb;v+~<$`Zi^wx6yxBvgIR5-luw9Yd}c@}Gd6E<%ed0qZ#{tfX~yt{Og6JO;? z*5$s%pZxBbNP7LXnYJZMXo}aldpG}xHWgpHt}PPSE_r75u^z2w2F;npGa8xH)2hy_ zI_%RPSv+H=*v6jk9Xrn@N#-dAKX2Z4*)V36*V=8%I;S@!a~Z#yafnAIct#_TS>TiC zCJSReJkO9G(rV8<=b&cdt2nQfRzHg>H18i;TGKuM#`X`LwYO)^{mJ=k^Z5S literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.25x/btn-plugin-panel-default.png b/apps/common/main/resources/img/toolbar/1.25x/btn-plugin-panel-default.png new file mode 100644 index 0000000000000000000000000000000000000000..6bf17766a6c9907d4907ac4195d9af55cbd835f4 GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^MnEjd!VDxEs}jnAlwyESh%1o(|NlQ8@_qP`!$4`y zk|4iehWqy$8Wa>9930}#?*R%ndAc};Xq-=8z?l%)bY!CmL$J^4u(d%61zAN5g(~Ui z=A1a7qsKGtA=4vPova)!g>x)yY<_Hq8yuK-^aL|GPht*fi=5IJDxtTzsj)GcF{EvC zL*qiBez`;68t$-7X57j9Fl$16!aBC!?K}+zygm-T%)$lY4IDG-4;*UBlq%>gTe~DWM4f8M|3R literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.5x/big/btn-plugin-default.png b/apps/common/main/resources/img/toolbar/1.5x/big/btn-plugin-default.png new file mode 100644 index 0000000000000000000000000000000000000000..92b2d256c2ed09fc7e914425181e406337bd4c1b GIT binary patch literal 316 zcmeAS@N?(olHy`uVBq!ia0vp^AwaCf!VDzu=O#J>Dd_;85LY1m|NnoiqD)+Hv+2|GFC7$Z`POD5uk$L+opd(*Ig-BrHKjw(A#<2PB^7cL*1nIIm$$j79Q9_wBrm*ntzWVm|;`HNdfJk0!b6vz4{eSj5$Wpafq@kY6yv{re3H3JvuM2>}5P4xU$z{$*fbWbkxx4DmSr_VQU?Mn{QbAH!?f ze{kq3JZj+c5K+()5bfZaGuMT+uP-aGk;}!z;n~eMzf;t$jj9FPEB%!x*VpY%4m)%t z*xJfWZ(Wl4gexbvtG|?fdM|7CF2mT8AIX1??QziQ?s_73aSPAIsg@I$C(KfC5y|v0 zDR(}zWI=}*kaLl#MIe#UNl;9og@aqbC89y$5EBcK*RjDu@{q#flt4q437bRjJW86O z^D64i+C?JvS8sh^nX;MX;`h2@1%(=aaSo3A^#VX5n#qMz?A>e*5P6%=h4bFG_3=|e z*7x-`|0((*7ZdsZ;MCHvn8@^_p&Cvf!(FG{mQy=j!*Fir{^Y!xj~79q=;`X`vd$@? F2>>l4oW1}6 literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.75x/btn-plugin-panel-default.png b/apps/common/main/resources/img/toolbar/1.75x/btn-plugin-panel-default.png new file mode 100644 index 0000000000000000000000000000000000000000..351b6282d988b97b7e17bf8fd2c53ba6bb64bec9 GIT binary patch literal 384 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!3-qjPWHqDDUSf35LY1m|NnnD31L7)klDy0 zaB*afo14s50VTvrg8YIR?%!8Xs9#XOV17e>{`vFUCrsGCJ|V&H$)O^kii@5ujv*e$ z-(J4Wb;v+~<$`Zi^wx6yxBvgIR5-luw9Yd}c@}Gd6E<%ed0qZ#{tfX~yt{Og6JO;? z*5$s%pZxBbNP7LXnYJZMXo}aldpG}xHWgpHt}PPSE_r75u^z2w2F;npGa8xH)2hy_ zI_%RPSv+H=*v6jk9Xrn@N#-dAKX2Z4*)V36*V=8%I;S@!a~Z#yafnAIct#_TS>TiC zCJSReJkO9G(rV8<=b&cdt2nQfRzHg>H18i;TGKuM#`X`LwYO)^{mJ=k^Z5S literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1x/big/btn-plugin-default.png b/apps/common/main/resources/img/toolbar/1x/big/btn-plugin-default.png new file mode 100644 index 0000000000000000000000000000000000000000..f3328d1c0962b5e5e002b4f96c7e8edfff2dc7b3 GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^7ClHK z4kU;$Oir1YkdRT*;GJibkdSb#)l)AgA>qMJ*sXDBEzd}mFOyUzHhvDaXltVd0|^l3Jgd5SVe_*H&9 m~P`{{0CP`g5n(+5*M$JY5_^BrYc_h#H6J& z0Rk!~P9895^aR4j#^%O_je!k;3|bLK4lH01 + + + + + diff --git a/apps/common/main/resources/img/toolbar/2.5x/btn-plugin-panel-default.svg b/apps/common/main/resources/img/toolbar/2.5x/btn-plugin-panel-default.svg new file mode 100644 index 0000000000..e9bf40e494 --- /dev/null +++ b/apps/common/main/resources/img/toolbar/2.5x/btn-plugin-panel-default.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/common/main/resources/img/toolbar/2x/big/btn-plugin-default.png b/apps/common/main/resources/img/toolbar/2x/big/btn-plugin-default.png new file mode 100644 index 0000000000000000000000000000000000000000..2890d836cddeb82332dcf0b265e703d97071eaf1 GIT binary patch literal 435 zcmeAS@N?(olHy`uVBq!ia0vp^1wd@U!3-pYOnWMTlv#jJh%1o(|NlQ$5?K(a23Z+f zgozGNTA(DzFPP!}{qyGq1QZk!-oH`Wrec`>FSc66X+ot+ z(gYhdrwKMfh8}XlK-?*y(%&ti(%;Dd!e5?DoM9kwLfNpaVI^x7&oMCxs{>n0m#{T^ zzxKHQ^K#9{s6AgF{r{KwxZj+uT|R%qJO+;Imm?!$?lajLb-#^0(6`q4ez;*%>T83B zu8WfMqvZTLx-Z&D+`08G_|B~s&Ai-0BHPRoyY%7aHKmDjM=Z{y=rM@UjhC lIl*djau0beE+8uXwsRhIkx*d*v)wtAYqi!q)$n zUd{Ple}h|4xMvQ>p`)tlPjl=#N@9FZZZX{U&T&?4zFeiF=@xz){YS=yv%mV>c<{AW zO>gp?kKB9Koj$tY1W&$<@kMT~Ql8t_D~8pMU)|t8&v^58XXFkLBZb@oL@*jn{84f3DE@@`bDK@b8~q zD+~XN-*SF+OfJa$`-I(F+wYwH`6w?o=bh-92htOuBDPQR-YI^cb^Zx^%4s!5&hW3r QK>sm#y85}Sb4q9e0D>K(!2kdN literal 0 HcmV?d00001