From 61193b2f6acf3cd10ac2ccaf9153d3885a206c7b Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 7 Apr 2020 17:28:12 +0300 Subject: [PATCH] [DE mobile] Comments (add modal comfirm when detele comment/draft) --- .../mobile/lib/controller/Collaboration.js | 19 ++++++++++++-- .../mobile/app/controller/add/AddOther.js | 25 ++++++++++++++++++- .../mobile/app/template/AddOther.template | 2 +- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 688c3418c..49dddb733 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -1288,7 +1288,20 @@ define([ break; case 'delete': addOverlay(); - me.onDeleteComment(idComment); + uiApp.modal({ + title: this.textDeleteComment, + text: this.textMessageDeleteComment, + buttons: [ + { + text: this.textCancel + }, + { + text: this.textYes, + onClick: function () { + me.onDeleteComment(idComment); + } + }] + }); me.disabledViewComments(false); break; case 'editreply': @@ -1998,7 +2011,9 @@ define([ textEditComment: 'Edit comment', textDeleteReply: 'Delete reply', textEditReply: 'Edit reply', - textReopen: 'Reopen' + textReopen: 'Reopen', + textMessageDeleteComment: 'Do you really want to delete this comment?', + textYes: 'Yes' } })(), Common.Controllers.Collaboration || {})) diff --git a/apps/documenteditor/mobile/app/controller/add/AddOther.js b/apps/documenteditor/mobile/app/controller/add/AddOther.js index da9a96245..36f25503c 100644 --- a/apps/documenteditor/mobile/app/controller/add/AddOther.js +++ b/apps/documenteditor/mobile/app/controller/add/AddOther.js @@ -119,6 +119,26 @@ define([ if (comment) { this.getView('AddOther').renderComment(comment); $('#done-comment').single('click', _.bind(this.onDoneComment, this)); + $('.back-from-add-comment').single('click', _.bind(function () { + if ($('#comment-text').val().length > 0) { + uiApp.modal({ + title: '', + text: this.textDeleteDraft, + buttons: [ + { + text: this.textCancel + }, + { + text: this.textContinue, + onClick: function () { + DE.getController('AddContainer').rootView.router.back(); + } + }] + }) + } else { + DE.getController('AddContainer').rootView.router.back(); + } + }, this)) } }, @@ -384,7 +404,10 @@ define([ txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"', textBottomOfPage: 'Bottom Of Page', - textBelowText: 'Below Text' + textBelowText: 'Below Text', + textDeleteDraft: 'Delete draft?', + textCancel: 'Cancel', + textContinue: 'Continue' } })(), DE.Controllers.AddOther || {})) diff --git a/apps/documenteditor/mobile/app/template/AddOther.template b/apps/documenteditor/mobile/app/template/AddOther.template index 3f6b0493c..f646fe425 100644 --- a/apps/documenteditor/mobile/app/template/AddOther.template +++ b/apps/documenteditor/mobile/app/template/AddOther.template @@ -342,7 +342,7 @@