Procházet zdrojové kódy

Delete checklist moved to checklist menu action

Martin Filser před 3 roky
rodič
revize
e40e42103e

+ 3 - 1
client/components/cards/checklists.jade

@@ -32,7 +32,6 @@ template(name="checklistDetail")
         span
         if canModifyCard
           a.fa.fa-navicon.checklist-details-menu.js-open-checklist-details-menu(title="{{_ 'checklistActionsPopup-title'}}")
-          a.js-delete-checklist.toggle-delete-checklist-dialog {{_ "delete"}}...
 
         if canModifyCard
           h2.title.js-open-inlined-form.is-editable
@@ -138,3 +137,6 @@ template(name="boardsSwimlanesAndLists")
 template(name="checklistActionsPopup")
   ul.pop-over-list
     li
+      a.js-delete-checklist.delete-checklist
+        i.fa.fa-trash
+        | {{_ "delete"}}...

+ 16 - 7
client/components/cards/checklists.js

@@ -191,13 +191,6 @@ BlazeComponent.extendComponent({
       {
         ...events,
         'click .js-open-checklist-details-menu': Popup.open('checklistActions'),
-        'click .toggle-delete-checklist-dialog' : Popup.afterConfirm('checklistDelete', function () {
-          Popup.close();
-          const checklist = this.checklist;
-          if (checklist && checklist._id) {
-            Checklists.remove(checklist._id);
-          }
-        }),
         'submit .js-add-checklist': this.addChecklist,
         'submit .js-edit-checklist-title': this.editChecklist,
         'submit .js-add-checklist-item': this.addChecklistItem,
@@ -294,6 +287,22 @@ BlazeComponent.extendComponent({
   }
 }).register('addChecklistItemForm');
 
+BlazeComponent.extendComponent({
+  events() {
+    return [
+      {
+        'click .js-delete-checklist' : Popup.afterConfirm('checklistDelete', function () {
+          Popup.back(2);
+          const checklist = this.checklist;
+          if (checklist && checklist._id) {
+            Checklists.remove(checklist._id);
+          }
+        }),
+      }
+    ]
+  }
+}).register('checklistActionsPopup');
+
 BlazeComponent.extendComponent({
   onRendered() {
     autosize(this.$('textarea.js-edit-checklist-item'));

+ 0 - 3
client/components/cards/checklists.styl

@@ -39,9 +39,6 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item
     &.is-finished
       color: #3cb500
 
-  .js-delete-checklist
-    @extends .delete-text
-
   span.fa.checklist-handle
     padding-right: 20px
     padding-top: 3px