From 1723da332490171e53bf381fc8a0ed2c2484c9ab Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Fri, 17 May 2019 15:00:52 +0300 Subject: [PATCH] [DE mobile] Add check for mode = review into collaboration settings --- .../mobile/app/controller/Collaboration.js | 29 +++++++++++-------- .../app/template/Collaboration.template | 4 +-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/Collaboration.js b/apps/documenteditor/mobile/app/controller/Collaboration.js index daf3ba54e..0962553f0 100644 --- a/apps/documenteditor/mobile/app/controller/Collaboration.js +++ b/apps/documenteditor/mobile/app/controller/Collaboration.js @@ -53,9 +53,6 @@ define([ var _settings = [], _headerType = 1, rootView, - _isReviewOnly = false, - _fileKey, - _canReview = false, displayMode = "Markup", arrChangeReview = []; @@ -84,10 +81,9 @@ define([ this.createView('Collaboration').render(); }, - setMode: function (mode) { - _isReviewOnly = mode.isReviewOnly; - _fileKey = mode.fileKey; - _canReview = mode.canReview; + setMode: function(mode) { + this.appConfig = mode; + return this; }, @@ -173,21 +169,25 @@ define([ initReviewingSettingsView: function () { var me = this; - $('#settings-review input:checkbox').attr('checked', _isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes-" + (_fileKey || ''))); + $('#settings-review input:checkbox').attr('checked', this.appConfig.isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes")); $('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me)); - if (_isReviewOnly) $layour.find('#settings-review').addClass('disabled'); $('#settings-accept-all').single('click', _.bind(me.onAcceptAllClick, me)); $('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, me)); + if(this.appConfig.isReviewOnly) { + $('#settings-accept-all').addClass('disabled'); + $('#settings-reject-all').addClass('disabled'); + $('#settings-review').addClass('disabled'); + } }, onTrackChanges: function(e) { var $checkbox = $(e.currentTarget), state = $checkbox.is(':checked'); - if ( _isReviewOnly ) { + if ( this.appConfig.isReviewOnly ) { $checkbox.attr('checked', true); - } else if ( _canReview ) { + } else { this.api.asc_SetTrackRevisions(state); - Common.localStorage.setItem("de-mobile-track-changes-" + (_fileKey || ''), state ? 1 : 0); + Common.localStorage.setItem("de-mobile-track-changes", state ? 1 : 0); } }, @@ -234,6 +234,7 @@ define([ } }, + initChange: function() { if(arrChangeReview.length == 0) { this.api.asc_GetNextRevisionsChange(); @@ -245,6 +246,10 @@ 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'); + } }, diff --git a/apps/documenteditor/mobile/app/template/Collaboration.template b/apps/documenteditor/mobile/app/template/Collaboration.template index 53b61d022..1cda4cd3c 100644 --- a/apps/documenteditor/mobile/app/template/Collaboration.template +++ b/apps/documenteditor/mobile/app/template/Collaboration.template @@ -174,8 +174,8 @@
- Accept - Reject + Accept + Reject