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

Thanks to xet7 !

Related #2389
This commit is contained in:
Lauri Ojansivu 2019-05-10 20:50:53 +03:00
parent 7ff4067e88
commit 828f6ea321
4 changed files with 38 additions and 2 deletions

View file

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

View file

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

View file

@ -106,15 +106,29 @@ $spaceBetweenTiles = 16px
transition-duration: .15s
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
&:hover
.fa-star,
.fa-clone,
.fa-archive,
.fa-star-o
color: white
.fa-star,
.fa-clone,
.fa-archive,
.fa-star-o
color: white
opacity: .75

View file

@ -867,6 +867,22 @@ if (Meteor.isServer) {
} 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) {