editor: gutter comments - delete comment confirmation dialog
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 28 May 2014 09:17:18 +0000 (11:17 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 28 May 2014 12:45:59 +0000 (14:45 +0200)
src/editor/modules/documentCanvas/canvas/comments/comment.html
src/editor/modules/documentCanvas/canvas/comments/comments.js
src/editor/modules/documentCanvas/canvas/comments/comments.less

index 68c14c1..3e9fb28 100644 (file)
         <a href="#" class="edit-start-btn"><%= gettext('edit') %></a> -
         <a href="#" class="remove-btn"><%= gettext('remove') %></a>
     </div>
         <a href="#" class="edit-start-btn"><%= gettext('edit') %></a> -
         <a href="#" class="remove-btn"><%= gettext('remove') %></a>
     </div>
+    <div class="deleteDialog">
+        <div><%= gettext('Delete this comment?') %></div>
+        <div>
+            <button class="btn btn-mini deleteDialog-confirm"><%= gettext('Delete') %></button>
+            <button class="btn btn-mini deleteDialog-cancel"><%= gettext('Cancel') %></button>
+        </div>
+    </div>
 </div>
 </div>
index 692c0b7..632616b 100644 (file)
@@ -158,8 +158,13 @@ var CommentView = function(commentNode) {
 
     this.contentElement = this.dom.find('.content');
     this.editElement = this.dom.find('.edit');
 
     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.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), {
         this.node.document.transaction(function() {
             this.node.detach();
         }.bind(this), {
@@ -169,6 +174,10 @@ var CommentView = function(commentNode) {
         });
     }.bind(this));
 
         });
     }.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));
     this.dom.find('.edit-start-btn').on('click', function() {
         this.startEditing();
     }.bind(this));
index 140e836..4c68e64 100644 (file)
@@ -4,6 +4,7 @@
     font-size: 12px;
 
     .comment {
     font-size: 12px;
 
     .comment {
+        position: relative;
         
         border-color: @borderColor;
         border-style: solid;
         
         border-color: @borderColor;
         border-style: solid;
         .edit {
             display: none;
         }
         .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 {
     }
 
     .newComment {