Ver código fonte

Fix problems highlighted by Codacy/PR Quality Review

RJevnikar 7 anos atrás
pai
commit
78b9436f38

+ 5 - 0
client/components/boards/boardHeader.jade

@@ -129,6 +129,7 @@ template(name="boardMenuPopup")
       ul.pop-over-list
         li: a(href="{{exportUrl}}", download="{{exportFilename}}") {{_ 'export-board'}}
         li: a.js-archive-board {{_ 'archive-board'}}
+        li: a.js-delete-board {{_ 'delete-board'}}
         li: a.js-outgoing-webhooks {{_ 'outgoing-webhooks'}}
   if isSandstorm
     hr
@@ -237,6 +238,10 @@ template(name="archiveBoardPopup")
   p {{_ 'close-board-pop'}}
   button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
 
+template(name="deleteBoardPopup")
+  p {{_ 'delete-board-pop'}}
+  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}
+
 template(name="outgoingWebhooksPopup")
   each integrations
     form.integration-form

+ 6 - 0
client/components/boards/boardHeader.js

@@ -17,6 +17,12 @@ Template.boardMenuPopup.events({
     // confirm that the board was successfully archived.
     FlowRouter.go('home');
   }),
+  'click .js-delete-board': Popup.afterConfirm('deleteBoard', function() {
+    const currentBoard = Boards.findOne(Session.get('currentBoard'));
+    Popup.close();
+    Boards.remove(currentBoard._id);
+    FlowRouter.go('home');
+  }),
   'click .js-outgoing-webhooks': Popup.open('outgoingWebhooks'),
   'click .js-import-board': Popup.open('chooseBoardSource'),
 });

+ 1 - 1
client/components/cards/cardDetails.js

@@ -156,7 +156,7 @@ BlazeComponent.extendComponent({
       'submit .js-card-details-requester'(evt) {
         evt.preventDefault();
         const requester = this.currentComponent().getValue().trim();
-        if (requestor) {
+        if (requester) {
           this.data().setRequestedBy(requester);
         }
       },

+ 1 - 1
models/cards.js

@@ -68,7 +68,7 @@ Cards.attachSchema(new SimpleSchema({
   },
   requestedBy: {
     type: String,
-    optional: true
+    optional: true,
   },
   assignedBy: {
     type: String,