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