From d27c3b0ca3b7ab149d9ee5e0fd7883e4838dbc2c Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Thu, 18 Jul 2019 17:32:15 +0300 Subject: [PATCH] [DE mobile] [SSE mobile] Add Commenting Display settings --- .../mobile/app/controller/Main.js | 3 +- .../mobile/app/controller/Settings.js | 36 ++++++++++++++++++ .../mobile/app/template/Settings.template | 28 ++++++++++++++ .../mobile/app/view/Settings.js | 5 ++- .../mobile/app/controller/Main.js | 6 +-- .../mobile/app/controller/Settings.js | 38 +++++++++++++++++++ .../mobile/app/template/Settings.template | 27 +++++++++++++ .../mobile/app/view/Settings.js | 5 ++- 8 files changed, 142 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index deed7d300..45cbc4f19 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -516,7 +516,8 @@ define([ /** coauthoring begin **/ this.isLiveCommenting = Common.localStorage.getBool("de-settings-livecomment", true); - this.isLiveCommenting ? this.api.asc_showComments(true) : this.api.asc_hideComments(); + var resolved = Common.localStorage.getBool("de-settings-resolvedcomment", true); + this.isLiveCommenting ? this.api.asc_showComments(resolved) : this.api.asc_hideComments(); /** coauthoring end **/ value = Common.localStorage.getItem("de-settings-zoom"); diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index 9ed879014..0c676adf1 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -234,6 +234,16 @@ define([ $('#settings-hidden-borders input:checkbox').attr('checked', (Common.localStorage.getItem("de-mobile-hidden-borders") == 'true') ? true : false); $('#settings-hidden-borders input:checkbox').single('change', _.bind(me.onShowTableEmptyLine, me)); $('#settings-orthography').single('click', _.bind(me.onOrthographyCheck, me)); + var displayComments = Common.localStorage.getBool("de-settings-livecomment", true); + $('#settings-display-comments input:checkbox').attr('checked', displayComments); + $('#settings-display-comments input:checkbox').single('change', _.bind(me.onChangeDisplayComments, me)); + var displayResolved = Common.localStorage.getBool("de-settings-resolvedcomment", true); + if (!displayComments) { + $("#settings-display-resolved").addClass("disabled"); + displayResolved = false; + } + $('#settings-display-resolved input:checkbox').attr('checked', displayResolved); + $('#settings-display-resolved input:checkbox').single('change', _.bind(me.onChangeDisplayResolved, me)); Common.Utils.addScrollIfNeed('.page[data-page=settings-advanced-view]', '.page[data-page=settings-advanced-view] .page-content'); } else if ('#color-schemes-view' == pageId) { me.initPageColorSchemes(); @@ -260,6 +270,32 @@ define([ } }, + onChangeDisplayComments: function(e) { + var displayComments = $(e.currentTarget).is(':checked'); + if (!displayComments) { + this.api.asc_hideComments(); + $("#settings-display-resolved input").prop( "checked", false ); + Common.localStorage.setBool("de-settings-resolvedcomment", false); + $("#settings-display-resolved").addClass("disabled"); + } else { + var resolved = Common.localStorage.getBool("de-settings-resolvedcomment"); + this.api.asc_showComments(resolved); + $("#settings-display-resolved").removeClass("disabled"); + } + Common.localStorage.setBool("de-settings-livecomment", displayComments); + }, + + onChangeDisplayResolved: function(e) { + var displayComments = Common.localStorage.getBool("de-settings-livecomment"); + if (displayComments) { + var resolved = $(e.currentTarget).is(':checked'); + if (this.api) { + this.api.asc_showComments(resolved); + } + Common.localStorage.setBool("de-settings-resolvedcomment", resolved); + } + }, + clickCollaboration: function() { DE.getController('Common.Controllers.Collaboration').showModal(); }, diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index 7c8325042..a1e19eae9 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -639,6 +639,34 @@ +
<%= scope.textCommentingDisplay %>
+
+ +
+ diff --git a/apps/documenteditor/mobile/app/view/Settings.js b/apps/documenteditor/mobile/app/view/Settings.js index eb85b01ca..b796ced47 100644 --- a/apps/documenteditor/mobile/app/view/Settings.js +++ b/apps/documenteditor/mobile/app/view/Settings.js @@ -287,7 +287,10 @@ define([ textColorSchemes: 'Color Schemes', textNoCharacters: 'Nonprinting Characters', textHiddenTableBorders: 'Hidden Table Borders', - textCollaboration: 'Collaboration' + textCollaboration: 'Collaboration', + textCommentingDisplay: 'Commenting Display', + textDisplayComments: 'Display Comments', + textDisplayResolvedComments: 'Display Resolved Comments' } })(), DE.Views.Settings || {})) diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index de81e7b61..d42699006 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -507,9 +507,9 @@ define([ this.api.asc_setZoom(zf>0 ? zf : 1); /** coauthoring begin **/ - value = Common.localStorage.getItem("sse-settings-livecomment"); - this.isLiveCommenting = !(value!==null && parseInt(value) == 0); - this.isLiveCommenting?this.api.asc_showComments(true):this.api.asc_hideComments(); + this.isLiveCommenting = Common.localStorage.getBool("sse-settings-livecomment", true); + var resolved = Common.localStorage.getBool("sse-settings-resolvedcomment", true); + this.isLiveCommenting ? this.api.asc_showComments(resolved) : this.api.asc_hideComments(); if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) { // Force ON fast co-authoring mode diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 7babd4a74..126da3a34 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -549,6 +549,44 @@ define([ var $r1c1Style = $('.page[data-page=settings-application-view] #r1-c1-style input'); $r1c1Style.prop('checked',value); $r1c1Style.single('change', _.bind(me.clickR1C1Style, me)); + + //init Commenting Display + var displayComments = Common.localStorage.getBool("sse-settings-livecomment", true); + $('#settings-display-comments input:checkbox').attr('checked', displayComments); + $('#settings-display-comments input:checkbox').single('change', _.bind(me.onChangeDisplayComments, me)); + var displayResolved = Common.localStorage.getBool("sse-settings-resolvedcomment", true); + if (!displayComments) { + $("#settings-display-resolved").addClass("disabled"); + displayResolved = false; + } + $('#settings-display-resolved input:checkbox').attr('checked', displayResolved); + $('#settings-display-resolved input:checkbox').single('change', _.bind(me.onChangeDisplayResolved, me)); + }, + + onChangeDisplayComments: function(e) { + var displayComments = $(e.currentTarget).is(':checked'); + if (!displayComments) { + this.api.asc_hideComments(); + $("#settings-display-resolved input").prop( "checked", false ); + Common.localStorage.setBool("sse-settings-resolvedcomment", false); + $("#settings-display-resolved").addClass("disabled"); + } else { + var resolved = Common.localStorage.getBool("sse-settings-resolvedcomment"); + this.api.asc_showComments(resolved); + $("#settings-display-resolved").removeClass("disabled"); + } + Common.localStorage.setBool("sse-settings-livecomment", displayComments); + }, + + onChangeDisplayResolved: function(e) { + var displayComments = Common.localStorage.getBool("sse-settings-livecomment"); + if (displayComments) { + var resolved = $(e.currentTarget).is(':checked'); + if (this.api) { + this.api.asc_showComments(resolved); + } + Common.localStorage.setBool("sse-settings-resolvedcomment", resolved); + } }, clickR1C1Style: function(e) { diff --git a/apps/spreadsheeteditor/mobile/app/template/Settings.template b/apps/spreadsheeteditor/mobile/app/template/Settings.template index de6530a45..252d9bf79 100644 --- a/apps/spreadsheeteditor/mobile/app/template/Settings.template +++ b/apps/spreadsheeteditor/mobile/app/template/Settings.template @@ -462,6 +462,33 @@ +
<%= scope.textCommentingDisplay %>
+
+ +
diff --git a/apps/spreadsheeteditor/mobile/app/view/Settings.js b/apps/spreadsheeteditor/mobile/app/view/Settings.js index fdc640ed5..cc73f525a 100644 --- a/apps/spreadsheeteditor/mobile/app/view/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/view/Settings.js @@ -381,7 +381,10 @@ define([ textFormulaLanguage: 'Formula Language', textExample: 'Example', textR1C1Style: 'R1C1 Reference Style', - textRegionalSettings: 'Regional Settings' + textRegionalSettings: 'Regional Settings', + textCommentingDisplay: 'Commenting Display', + textDisplayComments: 'Display Comments', + textDisplayResolvedComments: 'Display Resolved Comments' } })(), SSE.Views.Settings || {})) }); \ No newline at end of file