From 7d1a4e14c92e7d82f6a251f70635457eacd7a7cc Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 9 Oct 2017 15:03:50 +0300 Subject: [PATCH] [DE] Remove spellcheck and document language buttons from the toolbar collaboration tab. --- .../main/lib/controller/ReviewChanges.js | 14 ++++- apps/common/main/lib/view/ReviewChanges.js | 58 ++++++++----------- .../main/app/controller/Statusbar.js | 2 + .../main/app/template/StatusBar.template | 1 + .../main/resources/less/toolbar.less | 2 +- 5 files changed, 41 insertions(+), 36 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index b41202351..8f5715283 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -132,7 +132,7 @@ define([ SetDisabled: function(state) { if (this.dlgChanges) this.dlgChanges.close(); - this.view && this.view.SetDisabled(state); + this.view && this.view.SetDisabled(state, this.langs); }, onApiShowChange: function (sdkchange) { @@ -561,6 +561,12 @@ define([ if (this.view) { this.view.$el.find('.no-group-mask').css('opacity', 1); + + this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) { + if ( button ) { + button.setDisabled(disable || this.langs.length<1); + } + }, this); } }, @@ -625,7 +631,11 @@ define([ setLanguages: function (array) { this.langs = array; - this.view.btnDocLang.setDisabled(this.langs.length<1); + this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) { + if ( button ) { + button.setDisabled(this.langs.length<1); + } + }, this); }, onDocLanguage: function() { diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 4a5b12f95..7efc10c76 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -412,14 +412,7 @@ define([ Common.Views.ReviewChanges = Common.UI.BaseView.extend(_.extend((function(){ var template = '
' + - '
' + - '' + - '
' + - '
' + - '' + - '
' + - '
' + - '
' + + '
' + '' + '' + '
' + @@ -434,8 +427,7 @@ define([ '
' + '' + '
' + - '
' + - '
' + + '
' + '' + '' + '' + @@ -494,8 +486,10 @@ define([ }); }); - this.btnDocLang.on('click', function (btn, e) { - me.fireEvent('lang:document', this); + this.btnsDocLang.forEach(function(button) { + button.on('click', function (b, e) { + me.fireEvent('lang:document', this); + }); }); this.btnSharing && this.btnSharing.on('click', function (btn, e) { @@ -579,20 +573,8 @@ define([ }); } - this.btnSetSpelling = new Common.UI.Button({ - cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-ic-docspell', - caption: this.txtSpelling, - enableToggle: true - }); - this.btnsSpelling = [this.btnSetSpelling]; - - this.btnDocLang = new Common.UI.Button({ - cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-ic-doclang', - caption: this.txtDocLang, - disabled: true - }); + this.btnsSpelling = []; + this.btnsDocLang = []; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -689,9 +671,6 @@ define([ .next('.group').hide(); } - me.btnDocLang.updateHint(me.tipSetDocLang); - me.btnSetSpelling.updateHint(me.tipSetSpelling); - me.btnSharing && me.btnSharing.updateHint(me.tipSharing); if (me.btnCoAuthMode) { @@ -741,9 +720,6 @@ define([ this.btnReviewView.render(this.$el.find('#btn-review-view')); } - this.btnSetSpelling.render(this.$el.find('#slot-btn-spelling')); - this.btnDocLang.render(this.$el.find('#slot-set-lang')); - this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing')); this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode')); @@ -791,6 +767,17 @@ define([ }); this.btnsSpelling.push(button); + return button; + } else if (type == 'doclang' && parent == 'statusbar' ) { + button = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'btn-ic-doclang', + hintAnchor : 'top', + hint: this.tipSetDocLang, + disabled: true + }); + this.btnsDocLang.push(button); + return button; } }, @@ -831,12 +818,17 @@ define([ } }, - SetDisabled: function (state) { + SetDisabled: function (state, langs) { this.btnsSpelling && this.btnsSpelling.forEach(function(button) { if ( button ) { button.setDisabled(state); } }, this); + this.btnsDocLang && this.btnsDocLang.forEach(function(button) { + if ( button ) { + button.setDisabled(state || langs && langs.length<1); + } + }, this); this.btnsTurnReview && this.btnsTurnReview.forEach(function(button) { if ( button ) { button.setDisabled(state); diff --git a/apps/documenteditor/main/app/controller/Statusbar.js b/apps/documenteditor/main/app/controller/Statusbar.js index f275bba77..b1028280e 100644 --- a/apps/documenteditor/main/app/controller/Statusbar.js +++ b/apps/documenteditor/main/app/controller/Statusbar.js @@ -99,6 +99,8 @@ define([ me.btnSpelling = review.getButton('spelling', 'statusbar'); me.btnSpelling.render( me.statusbar.$layout.find('#btn-doc-spell') ); + me.btnDocLang = review.getButton('doclang', 'statusbar'); + me.btnDocLang.render( me.statusbar.$layout.find('#btn-doc-lang') ); } else { me.statusbar.$el.find('.el-edit, .el-review').hide(); } diff --git a/apps/documenteditor/main/app/template/StatusBar.template b/apps/documenteditor/main/app/template/StatusBar.template index 4d7133891..c9cccb90e 100644 --- a/apps/documenteditor/main/app/template/StatusBar.template +++ b/apps/documenteditor/main/app/template/StatusBar.template @@ -19,6 +19,7 @@
+
diff --git a/apps/documenteditor/main/resources/less/toolbar.less b/apps/documenteditor/main/resources/less/toolbar.less index 171114fe6..64398875b 100644 --- a/apps/documenteditor/main/resources/less/toolbar.less +++ b/apps/documenteditor/main/resources/less/toolbar.less @@ -327,7 +327,7 @@ //.button-normal-icon(btn-text, 46, @toolbar-icon-size); //.button-normal-icon(btn-insertequation, 53, @toolbar-icon-size); //.button-normal-icon(btn-dropcap, 50, @toolbar-icon-size); -//.button-normal-icon(btn-ic-doclang, 67, @toolbar-icon-size); +.button-normal-icon(btn-ic-doclang, 67, @toolbar-icon-size); //.button-normal-icon(btn-notes, 78, @toolbar-icon-size); //.button-normal-icon(review-prev, 79, @toolbar-icon-size); //.button-normal-icon(review-next, 80, @toolbar-icon-size);