From 2b589ff1348083317b6fba787c1b4fd61eecf8c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 28 May 2014 11:17:18 +0200 Subject: [PATCH] editor: gutter comments - delete comment confirmation dialog --- .../documentCanvas/canvas/comments/comment.html | 7 +++++++ .../documentCanvas/canvas/comments/comments.js | 9 +++++++++ .../documentCanvas/canvas/comments/comments.less | 14 ++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/editor/modules/documentCanvas/canvas/comments/comment.html b/src/editor/modules/documentCanvas/canvas/comments/comment.html index 68c14c1..3e9fb28 100644 --- a/src/editor/modules/documentCanvas/canvas/comments/comment.html +++ b/src/editor/modules/documentCanvas/canvas/comments/comment.html @@ -19,4 +19,11 @@ <%= gettext('edit') %> - <%= gettext('remove') %> +
+
<%= gettext('Delete this comment?') %>
+
+ + +
+
diff --git a/src/editor/modules/documentCanvas/canvas/comments/comments.js b/src/editor/modules/documentCanvas/canvas/comments/comments.js index 692c0b7..632616b 100644 --- a/src/editor/modules/documentCanvas/canvas/comments/comments.js +++ b/src/editor/modules/documentCanvas/canvas/comments/comments.js @@ -158,8 +158,13 @@ var CommentView = function(commentNode) { this.contentElement = this.dom.find('.content'); this.editElement = this.dom.find('.edit'); + this.deleteDialogElement = this.dom.find('.deleteDialog'); this.dom.find('.remove-btn').on('click', function() { + this.deleteDialogElement.show(); + }.bind(this)); + + this.dom.find('.deleteDialog-confirm').on('click', function() { this.node.document.transaction(function() { this.node.detach(); }.bind(this), { @@ -169,6 +174,10 @@ var CommentView = function(commentNode) { }); }.bind(this)); + this.dom.find('.deleteDialog-cancel').on('click', function() { + this.deleteDialogElement.hide(); + }.bind(this)); + this.dom.find('.edit-start-btn').on('click', function() { this.startEditing(); }.bind(this)); diff --git a/src/editor/modules/documentCanvas/canvas/comments/comments.less b/src/editor/modules/documentCanvas/canvas/comments/comments.less index 140e836..4c68e64 100644 --- a/src/editor/modules/documentCanvas/canvas/comments/comments.less +++ b/src/editor/modules/documentCanvas/canvas/comments/comments.less @@ -4,6 +4,7 @@ font-size: 12px; .comment { + position: relative; border-color: @borderColor; border-style: solid; @@ -34,6 +35,19 @@ .edit { display: none; } + + .deleteDialog { + display: none; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + padding-top: 15px; + color: white; + background-color: rgba(0,0,0,0.7); + text-align: center; + } } .newComment { -- 2.20.1