Browse Source

- Add Feature: Move board to Archive button at each board at All Boards page.

Thanks to xet7 !

Related #2389
Lauri Ojansivu 6 years ago
parent
commit
828f6ea321

+ 3 - 2
client/components/boards/boardsList.jade

@@ -30,8 +30,9 @@ template(name="boardList")
                 i.fa.js-clone-board(
                 i.fa.js-clone-board(
                     class="fa-clone"
                     class="fa-clone"
                     title="{{_ 'duplicate-board'}}")
                     title="{{_ 'duplicate-board'}}")
-
-
+                i.fa.js-archive-board(
+                    class="fa-archive"
+                    title="{{_ 'archive-board'}}")
 
 
 template(name="boardListHeaderBar")
 template(name="boardListHeaderBar")
   h1 {{_ 'my-boards'}}
   h1 {{_ 'my-boards'}}

+ 5 - 0
client/components/boards/boardsList.js

@@ -70,6 +70,11 @@ BlazeComponent.extendComponent({
         );
         );
         evt.preventDefault();
         evt.preventDefault();
       },
       },
+      'click .js-archive-board'(evt) {
+        const boardId = this.currentData()._id;
+        Meteor.call('archiveBoard', boardId);
+        evt.preventDefault();
+      },
       'click .js-accept-invite'() {
       'click .js-accept-invite'() {
         const boardId = this.currentData()._id;
         const boardId = this.currentData()._id;
         Meteor.user().removeInvite(boardId);
         Meteor.user().removeInvite(boardId);

+ 14 - 0
client/components/boards/boardsList.styl

@@ -106,15 +106,29 @@ $spaceBetweenTiles = 16px
     transition-duration: .15s
     transition-duration: .15s
     transition-property: color, font-size, background
     transition-property: color, font-size, background
 
 
+  .fa-archive
+    position: absolute;
+    bottom: 0
+    font-size: 14px
+    height: 18px
+    line-height: 18px
+    opacity: 0
+    left: 0
+    padding: 9px 9px
+    transition-duration: .15s
+    transition-property: color, font-size, background
+
   li:hover a
   li:hover a
     &:hover
     &:hover
       .fa-star,
       .fa-star,
       .fa-clone,
       .fa-clone,
+      .fa-archive,
       .fa-star-o
       .fa-star-o
         color: white
         color: white
 
 
     .fa-star,
     .fa-star,
     .fa-clone,
     .fa-clone,
+    .fa-archive,
     .fa-star-o
     .fa-star-o
       color: white
       color: white
       opacity: .75
       opacity: .75

+ 16 - 0
models/boards.js

@@ -867,6 +867,22 @@ if (Meteor.isServer) {
       } else throw new Meteor.Error('error-board-doesNotExist');
       } else throw new Meteor.Error('error-board-doesNotExist');
     },
     },
   });
   });
+
+  Meteor.methods({
+    archiveBoard(boardId) {
+      check(boardId, String);
+      const board = Boards.findOne(boardId);
+      if (board) {
+        const userId = Meteor.userId();
+        const index = board.memberIndex(userId);
+        if (index >= 0) {
+          board.archive();
+          return true;
+        } else throw new Meteor.Error('error-board-notAMember');
+      } else throw new Meteor.Error('error-board-doesNotExist');
+    },
+  });
+
 }
 }
 
 
 if (Meteor.isServer) {
 if (Meteor.isServer) {