[DE mobile] Add check for mode = review into collaboration settings

This commit is contained in:
Julia Svinareva 2019-05-17 15:00:52 +03:00
parent 0a1d461763
commit 1723da3324
2 changed files with 19 additions and 14 deletions

View file

@ -53,9 +53,6 @@ define([
var _settings = [], var _settings = [],
_headerType = 1, _headerType = 1,
rootView, rootView,
_isReviewOnly = false,
_fileKey,
_canReview = false,
displayMode = "Markup", displayMode = "Markup",
arrChangeReview = []; arrChangeReview = [];
@ -84,10 +81,9 @@ define([
this.createView('Collaboration').render(); this.createView('Collaboration').render();
}, },
setMode: function (mode) { setMode: function(mode) {
_isReviewOnly = mode.isReviewOnly; this.appConfig = mode;
_fileKey = mode.fileKey; return this;
_canReview = mode.canReview;
}, },
@ -173,21 +169,25 @@ define([
initReviewingSettingsView: function () { initReviewingSettingsView: function () {
var me = this; 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)); $('#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-accept-all').single('click', _.bind(me.onAcceptAllClick, me));
$('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, 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) { onTrackChanges: function(e) {
var $checkbox = $(e.currentTarget), var $checkbox = $(e.currentTarget),
state = $checkbox.is(':checked'); state = $checkbox.is(':checked');
if ( _isReviewOnly ) { if ( this.appConfig.isReviewOnly ) {
$checkbox.attr('checked', true); $checkbox.attr('checked', true);
} else if ( _canReview ) { } else {
this.api.asc_SetTrackRevisions(state); 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() { initChange: function() {
if(arrChangeReview.length == 0) { if(arrChangeReview.length == 0) {
this.api.asc_GetNextRevisionsChange(); this.api.asc_GetNextRevisionsChange();
@ -245,6 +246,10 @@ define([
$('#btn-next-change').single('click', _.bind(this.onNextChange, this)); $('#btn-next-change').single('click', _.bind(this.onNextChange, this));
$('#btn-accept-change').single('click', _.bind(this.onAcceptCurrentChange, this)); $('#btn-accept-change').single('click', _.bind(this.onAcceptCurrentChange, this));
$('#btn-reject-change').single('click', _.bind(this.onRejectCurrentChange, this)); $('#btn-reject-change').single('click', _.bind(this.onRejectCurrentChange, this));
if(!this.appConfig.isReviewOnly) {
$('#btn-accept-change').removeClass('disabled');
$('#btn-reject-change').removeClass('disabled');
}
}, },

View file

@ -174,8 +174,8 @@
<div class="content-block"> <div class="content-block">
<a href="#" id="btn-prev-change" class="link icon-only"><i class="icon icon-undo"></i></a> <a href="#" id="btn-prev-change" class="link icon-only"><i class="icon icon-undo"></i></a>
<a href="#" id="btn-next-change" class="link icon-only"><i class="icon icon-redo"></i></a> <a href="#" id="btn-next-change" class="link icon-only"><i class="icon icon-redo"></i></a>
<a href="#" id="btn-accept-change" class="link icon-only">Accept</a> <a href="#" id="btn-accept-change" class="link icon-only disabled">Accept</a>
<a href="#" id="btn-reject-change" class="link icon-only">Reject</a> <a href="#" id="btn-reject-change" class="link icon-only disabled">Reject</a>
</div> </div>
<div id="current-change" class="content-block"> <div id="current-change" class="content-block">
<p id="user-name"></p> <p id="user-name"></p>