2023-01-16 23:00:10 +01:00
|
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
2026-01-14 00:13:21 +02:00
|
|
|
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
2023-01-16 23:00:10 +01:00
|
|
|
|
2026-03-08 10:59:21 +02:00
|
|
|
Template.archivedBoards.onCreated(function () {
|
|
|
|
|
this.subscribe('archivedBoards');
|
|
|
|
|
});
|
2015-08-23 11:09:48 +02:00
|
|
|
|
2026-03-08 10:59:21 +02:00
|
|
|
Template.archivedBoards.helpers({
|
2020-12-17 21:27:02 +02:00
|
|
|
isBoardAdmin() {
|
2023-01-16 23:00:10 +01:00
|
|
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
2020-12-17 21:27:02 +02:00
|
|
|
},
|
|
|
|
|
|
2015-08-23 11:09:48 +02:00
|
|
|
archivedBoards() {
|
2023-02-09 23:16:44 +01:00
|
|
|
const ret = ReactiveCache.getBoards(
|
2019-06-28 12:52:09 -05:00
|
|
|
{ archived: true },
|
|
|
|
|
{
|
2021-02-01 22:11:10 +01:00
|
|
|
sort: { archivedAt: -1, modifiedAt: -1 },
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
|
|
|
|
);
|
2023-02-09 23:16:44 +01:00
|
|
|
return ret;
|
2015-08-23 11:09:48 +02:00
|
|
|
},
|
2026-03-08 10:59:21 +02:00
|
|
|
});
|
2015-08-23 11:09:48 +02:00
|
|
|
|
2026-03-08 10:59:21 +02:00
|
|
|
Template.archivedBoards.events({
|
|
|
|
|
async 'click .js-restore-board'() {
|
|
|
|
|
// TODO : Make isSandstorm variable global
|
|
|
|
|
const isSandstorm =
|
|
|
|
|
Meteor.settings &&
|
|
|
|
|
Meteor.settings.public &&
|
|
|
|
|
Meteor.settings.public.sandstorm;
|
|
|
|
|
if (isSandstorm && Utils.getCurrentBoardId()) {
|
|
|
|
|
const currentBoard = Utils.getCurrentBoard();
|
|
|
|
|
await currentBoard.archive();
|
|
|
|
|
}
|
|
|
|
|
const board = this;
|
|
|
|
|
await board.restore();
|
|
|
|
|
Utils.goBoardId(board._id);
|
2015-08-23 11:09:48 +02:00
|
|
|
},
|
2026-03-08 10:59:21 +02:00
|
|
|
'click .js-delete-board': Popup.afterConfirm('boardDelete', async function() {
|
|
|
|
|
Popup.back();
|
|
|
|
|
const isSandstorm =
|
|
|
|
|
Meteor.settings &&
|
|
|
|
|
Meteor.settings.public &&
|
|
|
|
|
Meteor.settings.public.sandstorm;
|
|
|
|
|
if (isSandstorm && Utils.getCurrentBoardId()) {
|
|
|
|
|
const currentBoard = Utils.getCurrentBoard();
|
|
|
|
|
await Boards.removeAsync(currentBoard._id);
|
|
|
|
|
}
|
|
|
|
|
await Boards.removeAsync(this._id);
|
|
|
|
|
FlowRouter.go('home');
|
|
|
|
|
}),
|
|
|
|
|
});
|