2015-08-23 11:09:48 +02:00
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
onCreated() {
|
2015-09-03 23:12:46 +02:00
|
|
|
this.subscribe('archivedBoards');
|
2015-08-23 11:09:48 +02:00
|
|
|
},
|
|
|
|
|
2020-12-17 21:27:02 +02:00
|
|
|
isBoardAdmin() {
|
|
|
|
return Meteor.user().isBoardAdmin();
|
|
|
|
},
|
|
|
|
|
2015-08-23 11:09:48 +02:00
|
|
|
archivedBoards() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return Boards.find(
|
|
|
|
{ archived: true },
|
|
|
|
{
|
2021-02-01 22:11:10 +01:00
|
|
|
sort: { archivedAt: -1, modifiedAt: -1 },
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
|
|
|
);
|
2015-08-23 11:09:48 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
'click .js-restore-board'() {
|
|
|
|
// TODO : Make isSandstorm variable global
|
|
|
|
const isSandstorm =
|
|
|
|
Meteor.settings &&
|
|
|
|
Meteor.settings.public &&
|
|
|
|
Meteor.settings.public.sandstorm;
|
|
|
|
if (isSandstorm && Session.get('currentBoard')) {
|
|
|
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
|
|
|
currentBoard.archive();
|
|
|
|
}
|
|
|
|
const board = this.currentData();
|
|
|
|
board.restore();
|
|
|
|
Utils.goBoardId(board._id);
|
|
|
|
},
|
|
|
|
'click .js-delete-board': Popup.afterConfirm('boardDelete', function() {
|
2021-10-21 10:35:16 +02:00
|
|
|
Popup.back();
|
2019-06-28 12:52:09 -05:00
|
|
|
const isSandstorm =
|
|
|
|
Meteor.settings &&
|
|
|
|
Meteor.settings.public &&
|
|
|
|
Meteor.settings.public.sandstorm;
|
|
|
|
if (isSandstorm && Session.get('currentBoard')) {
|
|
|
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
|
|
|
Boards.remove(currentBoard._id);
|
|
|
|
}
|
|
|
|
Boards.remove(this._id);
|
|
|
|
FlowRouter.go('home');
|
|
|
|
}),
|
2015-09-03 23:12:46 +02:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
];
|
2015-08-23 11:09:48 +02:00
|
|
|
},
|
2015-09-03 23:12:46 +02:00
|
|
|
}).register('archivedBoards');
|