wekan/client/components/sidebar/sidebarArchives.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-06-07 18:55:26 +02:00
BlazeComponent.extendComponent({
template() {
2015-06-07 18:55:26 +02:00
return 'archivesSidebar';
},
tabs() {
2015-08-22 02:06:49 +02:00
return [
2015-09-01 14:38:07 +02:00
{ name: TAPi18n.__('cards'), slug: 'cards' },
{ name: TAPi18n.__('lists'), slug: 'lists' },
];
2015-08-22 02:06:49 +02:00
},
archivedCards() {
2015-08-22 02:06:49 +02:00
return Cards.find({ archived: true });
},
archivedLists() {
2015-08-22 02:06:49 +02:00
return Lists.find({ archived: true });
2015-06-07 18:55:26 +02:00
},
cardIsInArchivedList() {
return this.currentData().list().archived;
},
onRendered() {
// XXX We should support dragging a card from the sidebar to the board
2015-06-07 18:55:26 +02:00
},
events() {
2015-06-07 18:55:26 +02:00
return [{
'click .js-restore-card'() {
const cardId = this.currentData()._id;
2015-06-07 18:55:26 +02:00
Cards.update(cardId, {$set: {archived: false}});
},
2015-08-22 02:06:49 +02:00
'click .js-delete-card': Popup.afterConfirm('cardDelete', function() {
const cardId = this._id;
2015-06-07 18:55:26 +02:00
Cards.remove(cardId);
Popup.close();
2015-08-22 02:06:49 +02:00
}),
'click .js-restore-list'() {
const listId = this.currentData()._id;
2015-08-22 02:06:49 +02:00
Lists.update(listId, {$set: {archived: false}});
},
2015-06-07 18:55:26 +02:00
}];
},
2015-06-07 18:55:26 +02:00
}).register('archivesSidebar');