From 8a0206392e545ec03dd3c4c060bdaa0550b40d58 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 24 Jun 2016 11:30:03 +0300 Subject: [PATCH] =?UTF-8?q?[DE]=20=D0=9F=D0=B0=D0=BD=D0=B5=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD=D0=BE=D0=B2=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B0=20=D0=B2=20=D1=81=D0=BE?= =?UTF-8?q?=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=81=20=D0=BC=D0=B0=D0=BA=D0=B5=D1=82=D0=B0=D0=BC=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/main/lib/controller/Plugins.js | 8 ++- apps/common/main/lib/view/Plugins.js | 43 ++++++++++++++-- .../img/plugin/icon_add_on_default.png | Bin 0 -> 441 bytes .../img/plugin/icon_add_on_default@2x.png | Bin 0 -> 1217 bytes apps/common/main/resources/less/plugins.less | 46 ++++++++++++++++-- .../main/app/controller/LeftMenu.js | 2 - apps/documenteditor/main/app/view/LeftMenu.js | 4 +- apps/documenteditor/main/locale/en.json | 1 + 8 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 apps/common/main/resources/img/plugin/icon_add_on_default.png create mode 100644 apps/common/main/resources/img/plugin/icon_add_on_default@2x.png diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 05a85f7c9..92a0380f1 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -119,8 +119,12 @@ define([ this.api.asc_pluginsRegister(this.panelPlugins.pluginsPath, arr); }, - onSelectPlugin: function(picker, item, record){ - this.api.asc_pluginRun(record.get('guid'), record.get('currentVariation'), ''); + onSelectPlugin: function(picker, item, record, e){ + var btn = $(e.target); + if (btn && btn.hasClass('plugin-caret')) { + // show plugin menu + } else + this.api.asc_pluginRun(record.get('guid'), record.get('currentVariation'), ''); }, onPluginShow: function(plugin) { diff --git a/apps/common/main/lib/view/Plugins.js b/apps/common/main/lib/view/Plugins.js index bf5d4b2bd..5de009b37 100644 --- a/apps/common/main/lib/view/Plugins.js +++ b/apps/common/main/lib/view/Plugins.js @@ -50,7 +50,7 @@ define([ 'use strict'; Common.Views.Plugins = Common.UI.BaseView.extend(_.extend({ - el: '#left-panel-plugins', + el: '#id-plugins-settings', storePlugins: undefined, template: _.template([ @@ -58,31 +58,68 @@ define([ '', '
', '
', + '', + '' ].join('')), initialize: function(options) { _.extend(this, options); this.pluginsPath = '../../../../sdkjs-plugins/'; + this._locked = false; + this._state = { + DisabledControls: true + }; + this.lockedControls = []; Common.UI.BaseView.prototype.initialize.call(this, arguments); }, render: function(el) { el = el || this.el; $(el).html(this.template({scope: this})); + this.$el = $(el); this.viewPluginsList = new Common.UI.DataView({ el: $('#plugins-list'), store: this.storePlugins, enableKeyEvents: false, - itemTemplate: _.template('
' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>); background-position: 0 0;">
') + itemTemplate: _.template([ + '
', + '
' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);">
', + '<% if (variations.length>1) { %>', + '
', + '<% } %>', + '<%= name %>', + '
' + ].join('')) }); + this.lockedControls.push(this.viewPluginsList); this.trigger('render:after', this); return this; }, - strPlugins: 'Plugins' + setLocked: function (locked) { + this._locked = locked; + }, + + ChangeSettings: function(props) { + this.disableControls(this._locked); + }, + + disableControls: function(disable) { + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + } + }, + + strPlugins: 'Add-ons' }, Common.Views.Plugins || {})); diff --git a/apps/common/main/resources/img/plugin/icon_add_on_default.png b/apps/common/main/resources/img/plugin/icon_add_on_default.png new file mode 100644 index 0000000000000000000000000000000000000000..0ecbe7474d4bf96721332a0d33d9d6249dbcfbd4 GIT binary patch literal 441 zcmV;q0Y?6bP))0004iNkl)-@Nm5ug^X>Ny@@MyBy*M zVj*qU{amx^sYX%<1B_-Yo#yz0yS|3=K$L9^a>ZSL3W(tq=lJZd7j25So^4N0p=IGW zDR=!EUlGGC7IMGh;v8`@M7{K3OlO;6JV7oYhN2vJaYr3D?NCk6DwyiSpae#yDHymWIO6%FB9OjbQ zDs0sG9caQ1A5y`FQpZ;&M}77|N=qZenP<-D@Qb1rOSnnMTQ5=|!DdZn^0Ztodc1W5 zl(UL*T`8Rh@q6hRE@-lw?`54XhOv}YOkj{eb6v>t%ZT49yP8{!

3Y&s=KqbPG}5 z@K29(?s_G~_H=RA-*btlq!CiQcGs^k#72G)(Y00000NkvXXu0mjf!cW#_ literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/plugin/icon_add_on_default@2x.png b/apps/common/main/resources/img/plugin/icon_add_on_default@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..151ae0dfbf7fd9b3451fb682ff3cd4e0794e0318 GIT binary patch literal 1217 zcmV;y1U~zTP)(pp+_jvlb=g5qXA>+$5zn))MMiG79rVh4n zkGFmXIdnNH=O&&bjbd8OrhfAIibr{tKdGeGY55-_9KkS~hG-Lg0!ft6$*|M%RhG6P zx@i-77{YK`zBOQhzMPF?DPKR9@(nhv2E&5k{4$SV(5J1BBI1NXIv8?V{wei72apD$ zc$;@wOf7v*@8PcDd(kCPMw5_B1UGo=57_SEM(81r^(U87>b2WGI7C*C` z6@1I1?9VKzUrM@~BWl^xO&MQs9Vc@tr*M*VF2@M|QSCgEE%FgjZ{aipy`J^A$%&}-T64d5b|w>U?oZX|*>`Y?hmFT;NKn$1gU zx__Y2Hq)y++bbEhrJj$xi5c=-L9cyEcWqClT0{+sMxhB8TX;mtKPCk?E>ucz;ih67 zCvh%kaSA7Mk|28}`F0NbGgT=jvMa}PqCAiDaxBMiJV$Z{r?XUuWFd=87PExq!t0!* zX8ZYkz*<(SjKE5%gp8ALESp))Dk-cI*2uT5e9C#!Ho^M`r}3I7mPvB4w8>LsOIRsA z5u7O;BOIqVo|8C{-B2UXWOkLrksOACBc*cCII3x*1(_`-Zdzz1g?FTF3ghMVMPj@& zvr$m97Z;_hcH7JVah#zix4+7C@r#=6-%@QaCxeUh!aO(c zrCD(no>L>GtAV8I-j{AnDSAfiFh9K$z00!MAOWWnKMjz2{-G>-KJXoDX~0Z z$xM>x+Z0=N7CjVjy|&y!6sOqa9wv)!pInzzt_-$(C6`(?qC(QX4Opsi@8n8j>_9fG*6KC;!%DejwF`z9glK72RkiqBSGXkgNEEZs;Nth znap7ZbU;`#Kv)Yzf~8y00000NkvXXu0mjf06$3e literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/less/plugins.less b/apps/common/main/resources/less/plugins.less index 3577df2dd..46b3dc455 100644 --- a/apps/common/main/resources/less/plugins.less +++ b/apps/common/main/resources/less/plugins.less @@ -16,11 +16,51 @@ #plugins-list { height: 100%; overflow: hidden; - padding: 30px 0 10px 10px; + padding: 30px 0 10px 0; + + .item { + display: block; + width: 100%; + .box-shadow(none); + margin: 0; + + &:hover, + &.over { + background-color: @secondary; + + .plugin-icon { + .box-shadow(0 0 0 2px @primary); + } + } + } .item-plugins { - width: 40px; - height: 40px; + width: 100%; + padding: 7px 1px 7px 12px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .plugin-icon { + width: 31px; + height: 31px; + display: inline-block; + .box-shadow(0 0 0 1px @gray); + vertical-align: middle; + background-position: 0 0; + background-size: cover; + margin-right: 10px; + + .background-ximage('@{common-image-path}/plugin/icon_add_on_default.png', '@{common-image-path}/plugin/icon_add_on_default@2x.png', 31px); + } + + .plugin-caret { + float: right; + width: 16px; + height: 16px; + background-position: -42px -195px; + margin: 7px; } } } diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index bdd66a471..f16dd7d38 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -174,8 +174,6 @@ define([ if (this.mode.canUseHistory) this.leftMenu.setOptionsPanel('history', this.getApplication().getController('Common.Controllers.History').getView('Common.Views.History')); - this.enablePlugins(); - Common.util.Shortcuts.resumeEvents(); return this; }, diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 061e5570e..78ae7fa34 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -227,7 +227,7 @@ define([ } } /** coauthoring end **/ - if (this.mode.canPlugins) { + if (this.mode.canPlugins && this.panelPlugins) { if (this.btnPlugins.pressed) { this.panelPlugins.show(); } else @@ -279,7 +279,7 @@ define([ this.panelChat['hide'](); this.btnChat.toggle(false, true); } - if (this.mode.canPlugins) { + if (this.mode.canPlugins && this.panelPlugins) { this.panelPlugins['hide'](); this.btnPlugins.toggle(false, true); } diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index f177f9bad..857f32aa1 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -157,6 +157,7 @@ "Common.Views.OpenDialog.okButtonText": "OK", "Common.Views.OpenDialog.txtEncoding": "Encoding ", "Common.Views.OpenDialog.txtTitle": "Choose %1 options", + "Common.Views.Plugins.strPlugins": "Add-ons", "Common.Views.ReviewChanges.txtAccept": "Accept", "Common.Views.ReviewChanges.txtAcceptAll": "Accept All Changes", "Common.Views.ReviewChanges.txtAcceptCurrent": "Accept Current Change",