summaryrefslogtreecommitdiffstats
path: root/client/components/boards/boardHeader.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/boards/boardHeader.js')
-rw-r--r--client/components/boards/boardHeader.js31
1 files changed, 11 insertions, 20 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index f259b2a6..19b463ed 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -7,8 +7,8 @@ Template.boardMenuPopup.events({
'click .js-change-board-color': Popup.open('boardChangeColor'),
'click .js-change-language': Popup.open('changeLanguage'),
'click .js-archive-board ': Popup.afterConfirm('archiveBoard', () => {
- const boardId = Session.get('currentBoard');
- Boards.update(boardId, { $set: { archived: true }});
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ currentBoard.archive();
// XXX We should have some kind of notification on top of the page to
// confirm that the board was successfully archived.
FlowRouter.go('home');
@@ -17,13 +17,9 @@ Template.boardMenuPopup.events({
Template.boardChangeTitlePopup.events({
submit(evt, tpl) {
- const title = tpl.$('.js-board-name').val().trim();
- if (title) {
- Boards.update(this._id, {
- $set: {
- title,
- },
- });
+ const newTitle = tpl.$('.js-board-name').val().trim();
+ if (newTitle) {
+ this.rename(newTitle);
Popup.close();
}
evt.preventDefault();
@@ -95,12 +91,9 @@ BlazeComponent.extendComponent({
events() {
return [{
'click .js-select-background'(evt) {
- const currentBoardId = Session.get('currentBoard');
- Boards.update(currentBoardId, {
- $set: {
- color: this.currentData().toString(),
- },
- });
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ const newColor = this.currentData().toString();
+ currentBoard.setColor(newColor);
evt.preventDefault();
},
}];
@@ -168,11 +161,9 @@ BlazeComponent.extendComponent({
},
selectBoardVisibility() {
- Boards.update(Session.get('currentBoard'), {
- $set: {
- permission: this.currentData(),
- },
- });
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ const visibility = this.currentData();
+ currentBoard.setVisibility(visibility);
Popup.close();
},