wekan/client/components/sidebar/sidebarArchives.js
Alexander Sulfrian b2ab174fd5 sidebar: Filter archived cards/lists for current board
The archived items should be filtered for the current board or else you
will get a global list of all archived items on all boards.
2015-09-24 12:32:48 +02:00

52 lines
1.1 KiB
JavaScript

BlazeComponent.extendComponent({
template() {
return 'archivesSidebar';
},
tabs() {
return [
{ name: TAPi18n.__('cards'), slug: 'cards' },
{ name: TAPi18n.__('lists'), slug: 'lists' },
];
},
archivedCards() {
return Cards.find({
archived: true,
boardId: Session.get('currentBoard'),
});
},
archivedLists() {
return Lists.find({
archived: true,
boardId: Session.get('currentBoard'),
});
},
cardIsInArchivedList() {
return this.currentData().list().archived;
},
onRendered() {
// XXX We should support dragging a card from the sidebar to the board
},
events() {
return [{
'click .js-restore-card'() {
const card = this.currentData();
card.restore();
},
'click .js-delete-card': Popup.afterConfirm('cardDelete', function() {
const cardId = this._id;
Cards.remove(cardId);
Popup.close();
}),
'click .js-restore-list'() {
const list = this.currentData();
list.restore();
},
}];
},
}).register('archivesSidebar');