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.js206
1 files changed, 119 insertions, 87 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index f2b5c4f5..cb84c233 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -45,15 +45,21 @@ Template.boardMenuPopup.helpers({
});
Template.boardChangeTitlePopup.events({
- submit(evt, tpl) {
- const newTitle = tpl.$('.js-board-name').val().trim();
- const newDesc = tpl.$('.js-board-desc').val().trim();
+ submit(event, templateInstance) {
+ const newTitle = templateInstance
+ .$('.js-board-name')
+ .val()
+ .trim();
+ const newDesc = templateInstance
+ .$('.js-board-desc')
+ .val()
+ .trim();
if (newTitle) {
this.rename(newTitle);
this.setDescription(newDesc);
Popup.close();
}
- evt.preventDefault();
+ event.preventDefault();
},
});
@@ -76,67 +82,79 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-edit-board-title': Popup.open('boardChangeTitle'),
- 'click .js-star-board'() {
- Meteor.user().toggleBoardStar(Session.get('currentBoard'));
+ return [
+ {
+ 'click .js-edit-board-title': Popup.open('boardChangeTitle'),
+ 'click .js-star-board'() {
+ Meteor.user().toggleBoardStar(Session.get('currentBoard'));
+ },
+ 'click .js-open-board-menu': Popup.open('boardMenu'),
+ 'click .js-change-visibility': Popup.open('boardChangeVisibility'),
+ 'click .js-watch-board': Popup.open('boardChangeWatch'),
+ 'click .js-open-archived-board'() {
+ Modal.open('archivedBoards');
+ },
+ 'click .js-toggle-board-view'() {
+ const currentUser = Meteor.user();
+ if (
+ (currentUser.profile || {}).boardView === 'board-view-swimlanes'
+ ) {
+ currentUser.setBoardView('board-view-cal');
+ } else if (
+ (currentUser.profile || {}).boardView === 'board-view-lists'
+ ) {
+ currentUser.setBoardView('board-view-swimlanes');
+ } else if (
+ (currentUser.profile || {}).boardView === 'board-view-cal'
+ ) {
+ currentUser.setBoardView('board-view-lists');
+ } else {
+ currentUser.setBoardView('board-view-swimlanes');
+ }
+ },
+ 'click .js-toggle-sidebar'() {
+ Sidebar.toggle();
+ },
+ 'click .js-open-filter-view'() {
+ Sidebar.setView('filter');
+ },
+ 'click .js-filter-reset'(event) {
+ event.stopPropagation();
+ Sidebar.setView();
+ Filter.reset();
+ },
+ 'click .js-open-search-view'() {
+ Sidebar.setView('search');
+ },
+ 'click .js-open-rules-view'() {
+ Modal.openWide('rulesMain');
+ },
+ 'click .js-multiselection-activate'() {
+ const currentCard = Session.get('currentCard');
+ MultiSelection.activate();
+ if (currentCard) {
+ MultiSelection.add(currentCard);
+ }
+ },
+ 'click .js-multiselection-reset'(event) {
+ event.stopPropagation();
+ MultiSelection.disable();
+ },
+ 'click .js-log-in'() {
+ FlowRouter.go('atSignIn');
+ },
},
- 'click .js-open-board-menu': Popup.open('boardMenu'),
- 'click .js-change-visibility': Popup.open('boardChangeVisibility'),
- 'click .js-watch-board': Popup.open('boardChangeWatch'),
- 'click .js-open-archived-board'() {
- Modal.open('archivedBoards');
- },
- 'click .js-toggle-board-view'() {
- const currentUser = Meteor.user();
- if ((currentUser.profile || {}).boardView === 'board-view-swimlanes') {
- currentUser.setBoardView('board-view-cal');
- } else if ((currentUser.profile || {}).boardView === 'board-view-lists') {
- currentUser.setBoardView('board-view-swimlanes');
- } else if ((currentUser.profile || {}).boardView === 'board-view-cal') {
- currentUser.setBoardView('board-view-lists');
- } else {
- currentUser.setBoardView('board-view-swimlanes');
- }
- },
- 'click .js-toggle-sidebar'() {
- Sidebar.toggle();
- },
- 'click .js-open-filter-view'() {
- Sidebar.setView('filter');
- },
- 'click .js-filter-reset'(evt) {
- evt.stopPropagation();
- Sidebar.setView();
- Filter.reset();
- },
- 'click .js-open-search-view'() {
- Sidebar.setView('search');
- },
- 'click .js-open-rules-view'() {
- Modal.openWide('rulesMain');
- },
- 'click .js-multiselection-activate'() {
- const currentCard = Session.get('currentCard');
- MultiSelection.activate();
- if (currentCard) {
- MultiSelection.add(currentCard);
- }
- },
- 'click .js-multiselection-reset'(evt) {
- evt.stopPropagation();
- MultiSelection.disable();
- },
- 'click .js-log-in'() {
- FlowRouter.go('atSignIn');
- },
- }];
+ ];
},
}).register('boardHeaderBar');
Template.boardHeaderBar.helpers({
canModifyBoard() {
- return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ return (
+ Meteor.user() &&
+ Meteor.user().isBoardMember() &&
+ !Meteor.user().isCommentOnly()
+ );
},
});
@@ -164,15 +182,17 @@ const CreateBoard = BlazeComponent.extendComponent({
this.visibilityMenuIsOpen.set(!this.visibilityMenuIsOpen.get());
},
- onSubmit(evt) {
- evt.preventDefault();
+ onSubmit(event) {
+ event.preventDefault();
const title = this.find('.js-new-board-title').value;
const visibility = this.visibility.get();
- this.boardId.set(Boards.insert({
- title,
- permission: visibility,
- }));
+ this.boardId.set(
+ Boards.insert({
+ title,
+ permission: visibility,
+ }),
+ );
Swimlanes.insert({
title: 'Default',
@@ -183,26 +203,28 @@ const CreateBoard = BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-select-visibility'() {
- this.setVisibility(this.currentData());
+ return [
+ {
+ 'click .js-select-visibility'() {
+ this.setVisibility(this.currentData());
+ },
+ 'click .js-change-visibility': this.toggleVisibilityMenu,
+ 'click .js-import': Popup.open('boardImportBoard'),
+ submit: this.onSubmit,
+ 'click .js-import-board': Popup.open('chooseBoardSource'),
+ 'click .js-board-template': Popup.open('searchElement'),
},
- 'click .js-change-visibility': this.toggleVisibilityMenu,
- 'click .js-import': Popup.open('boardImportBoard'),
- submit: this.onSubmit,
- 'click .js-import-board': Popup.open('chooseBoardSource'),
- 'click .js-board-template': Popup.open('searchElement'),
- }];
+ ];
},
}).register('createBoardPopup');
(class HeaderBarCreateBoard extends CreateBoard {
- onSubmit(evt) {
- super.onSubmit(evt);
+ onSubmit(event) {
+ super.onSubmit(event);
// Immediately star boards crated with the headerbar popup.
Meteor.user().toggleBoardStar(this.boardId.get());
}
-}).register('headerBarCreateBoardPopup');
+}.register('headerBarCreateBoardPopup'));
BlazeComponent.extendComponent({
visibilityCheck() {
@@ -218,9 +240,11 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-select-visibility': this.selectBoardVisibility,
- }];
+ return [
+ {
+ 'click .js-select-visibility': this.selectBoardVisibility,
+ },
+ ];
},
}).register('boardChangeVisibilityPopup');
@@ -235,13 +259,21 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-select-watch'() {
- const level = this.currentData();
- Meteor.call('watch', 'board', Session.get('currentBoard'), level, (err, ret) => {
- if (!err && ret) Popup.close();
- });
+ return [
+ {
+ 'click .js-select-watch'() {
+ const level = this.currentData();
+ Meteor.call(
+ 'watch',
+ 'board',
+ Session.get('currentBoard'),
+ level,
+ (err, ret) => {
+ if (!err && ret) Popup.close();
+ },
+ );
+ },
},
- }];
+ ];
},
}).register('boardChangeWatchPopup');