From 039d15c233a545b569a3ef53a8d368fe4620e249 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 21 May 2019 11:00:00 +0300 Subject: [PATCH] [DE mobile] Fix disabled settings when change Display Mode --- .../mobile/app/controller/Collaboration.js | 37 +++++++++++++------ .../mobile/app/controller/Settings.js | 9 +++++ .../mobile/app/controller/Toolbar.js | 11 +++++- .../app/template/Collaboration.template | 4 +- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/Collaboration.js b/apps/documenteditor/mobile/app/controller/Collaboration.js index 9877ad798..a7302470c 100644 --- a/apps/documenteditor/mobile/app/controller/Collaboration.js +++ b/apps/documenteditor/mobile/app/controller/Collaboration.js @@ -129,8 +129,7 @@ define([ '' + '' + '' + - '', - $$('#toolbar-edit') + '' ); } @@ -175,10 +174,14 @@ define([ $('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me)); $('#settings-accept-all').single('click', _.bind(me.onAcceptAllClick, me)); $('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, me)); - if(this.appConfig.isReviewOnly) { + if(this.appConfig.isReviewOnly || displayMode == "Final" || displayMode == "Original" ) { $('#settings-accept-all').addClass('disabled'); $('#settings-reject-all').addClass('disabled'); $('#settings-review').addClass('disabled'); + } else { + $('#settings-accept-all').removeClass('disabled'); + $('#settings-reject-all').removeClass('disabled'); + $('#settings-review').removeClass('disabled'); } }, @@ -218,6 +221,10 @@ define([ } }, + getDisplayMode: function() { + return displayMode; + }, + onReviewViewClick: function(event) { var value = $(event.currentTarget).val(); this.turnDisplayMode(value); @@ -234,6 +241,8 @@ define([ else this.api.asc_EndViewModeInReview(); } + this.initReviewingSettingsView(); + DE.getController('Toolbar').setDisplayMode(value); }, @@ -251,9 +260,15 @@ define([ $('#btn-next-change').single('click', _.bind(this.onNextChange, this)); $('#btn-accept-change').single('click', _.bind(this.onAcceptCurrentChange, this)); $('#btn-reject-change').single('click', _.bind(this.onRejectCurrentChange, this)); - if(!this.appConfig.isReviewOnly) { - $('#btn-accept-change').removeClass('disabled'); - $('#btn-reject-change').removeClass('disabled'); + if(this.appConfig.isReviewOnly) { + $('#btn-accept-change').addClass('disabled'); + $('#btn-reject-change').addClass('disabled'); + } + if(displayMode == "Final" || displayMode == "Original") { + $('#btn-accept-change').addClass('disabled'); + $('#btn-reject-change').addClass('disabled'); + $('#btn-prev-change').addClass('disabled'); + $('#btn-next-change').addClass('disabled'); } }, @@ -505,12 +520,12 @@ define([ - textInserted: 'Inserted:
', - textDeleted: 'Deleted:
', - textParaInserted: 'Paragraph Inserted
', - textParaDeleted: 'Paragraph Deleted
', + textInserted: 'Inserted:', + textDeleted: 'Deleted:', + textParaInserted: 'Paragraph Inserted ', + textParaDeleted: 'Paragraph Deleted ', textFormatted: 'Formatted', - textParaFormatted: 'Paragraph Formatted', + textParaFormatted: 'Paragraph Formatted', textNot: 'Not ', textBold: 'Bold', textItalic: 'Italic', diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index ffdc04af3..bf6192291 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -249,6 +249,10 @@ define([ $('#settings-download').single('click', _.bind(me.onDownloadOrigin, me)); $('#settings-print').single('click', _.bind(me.onPrint, me)); $('#settings-collaboration').single('click', _.bind(me.clickCollaboration, me)); + var _stateDisplayMode = DE.getController('Collaboration').getDisplayMode(); + if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") { + $('#settings-document').addClass('disabled'); + } } }, @@ -331,6 +335,11 @@ define([ var value = Common.localStorage.getItem('de-mobile-settings-unit'); value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); $unitMeasurement.val([value]); + var _stateDisplayMode = DE.getController('Collaboration').getDisplayMode(); + if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") { + $('#settings-no-characters').addClass('disabled'); + $('#settings-hidden-borders').addClass('disabled'); + } }, initPageDocumentSettings: function () { diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js index e1d1ed5b4..1bbb6344a 100644 --- a/apps/documenteditor/mobile/app/controller/Toolbar.js +++ b/apps/documenteditor/mobile/app/controller/Toolbar.js @@ -51,7 +51,8 @@ define([ DE.Controllers.Toolbar = Backbone.Controller.extend(_.extend((function() { // private - var _backUrl; + var _backUrl, + stateDisplayMode = false; return { models: [], @@ -149,6 +150,12 @@ define([ } }, + setDisplayMode: function(displayMode) { + stateDisplayMode = displayMode == "Final" || displayMode == "Original" ? true : false; + var selected = this.api.getSelectedElements(); + this.onApiFocusObject(selected); + }, + onApiFocusObject: function (objects) { if (this.isDisconnected) return; @@ -159,7 +166,7 @@ define([ topObjectValue = topObject.get_ObjectValue(), objectLocked = _.isFunction(topObjectValue.get_Locked) ? topObjectValue.get_Locked() : false; - $('#toolbar-add, #toolbar-edit').toggleClass('disabled', objectLocked); + $('#toolbar-add, #toolbar-edit').toggleClass('disabled', objectLocked || stateDisplayMode); } }, diff --git a/apps/documenteditor/mobile/app/template/Collaboration.template b/apps/documenteditor/mobile/app/template/Collaboration.template index af3fbdf5b..ad199f58f 100644 --- a/apps/documenteditor/mobile/app/template/Collaboration.template +++ b/apps/documenteditor/mobile/app/template/Collaboration.template @@ -180,8 +180,8 @@ - - + +