Преглед изворни кода

Comment, added confirm delete popup

Martin Filser пре 3 година
родитељ
комит
1a09b75974

+ 4 - 0
client/components/activities/activities.jade

@@ -21,6 +21,10 @@ template(name="editOrDeleteComment")
   = ' - '
   = ' - '
   a.js-delete-comment {{_ "delete"}}
   a.js-delete-comment {{_ "delete"}}
 
 
+template(name="deleteCommentPopup")
+  p {{_ "comment-delete"}}
+  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}
+
 template(name="commentReactions")
 template(name="commentReactions")
   .reactions
   .reactions
     each reaction in reactions
     each reaction in reactions

+ 4 - 3
client/components/activities/activities.js

@@ -220,10 +220,11 @@ BlazeComponent.extendComponent({
     return [
     return [
       {
       {
         // XXX We should use Popup.afterConfirmation here
         // XXX We should use Popup.afterConfirmation here
-        'click .js-delete-comment'() {
-          const commentId = this.currentData().activity.commentId;
+        'click .js-delete-comment': Popup.afterConfirm('deleteComment', () => {
+          const commentId = this.data().activity.commentId;
           CardComments.remove(commentId);
           CardComments.remove(commentId);
-        },
+          Popup.back();
+        }),
         'submit .js-edit-comment'(evt) {
         'submit .js-edit-comment'(evt) {
           evt.preventDefault();
           evt.preventDefault();
           const commentText = this.currentComponent()
           const commentText = this.currentComponent()

+ 2 - 0
i18n/en.i18n.json

@@ -271,6 +271,8 @@
   "comment-placeholder": "Write Comment",
   "comment-placeholder": "Write Comment",
   "comment-only": "Comment only",
   "comment-only": "Comment only",
   "comment-only-desc": "Can comment on cards only.",
   "comment-only-desc": "Can comment on cards only.",
+  "comment-delete": "Are you sure you want to delete the comment?",
+  "deleteCommentPopup-title": "Delete comment?",
   "no-comments": "No comments",
   "no-comments": "No comments",
   "no-comments-desc": "Can not see comments and activities.",
   "no-comments-desc": "Can not see comments and activities.",
   "worker": "Worker",
   "worker": "Worker",