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.js97
1 files changed, 97 insertions, 0 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index 222cc404..2dfd58c1 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -25,6 +25,7 @@ Template.boardMenuPopup.events({
}),
'click .js-outgoing-webhooks': Popup.open('outgoingWebhooks'),
'click .js-import-board': Popup.open('chooseBoardSource'),
+ 'click .js-subtask-settings': Popup.open('boardSubtaskSettings'),
});
Template.boardMenuPopup.helpers({
@@ -153,6 +154,102 @@ BlazeComponent.extendComponent({
},
}).register('boardChangeColorPopup');
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.currentBoard = Boards.findOne(Session.get('currentBoard'));
+ },
+
+ allowsSubtasks() {
+ return this.currentBoard.allowsSubtasks;
+ },
+
+ isBoardSelected() {
+ return this.currentBoard.subtasksDefaultBoardId === this.currentData()._id;
+ },
+
+ isNullBoardSelected() {
+ return (this.currentBoard.subtasksDefaultBoardId === null) || (this.currentBoard.subtasksDefaultBoardId === undefined);
+ },
+
+ boards() {
+ return Boards.find({
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ }, {
+ sort: ['title'],
+ });
+ },
+
+ lists() {
+ return Lists.find({
+ boardId: this.currentBoard._id,
+ archived: false,
+ }, {
+ sort: ['title'],
+ });
+ },
+
+ hasLists() {
+ return this.lists().count() > 0;
+ },
+
+ isListSelected() {
+ return this.currentBoard.subtasksDefaultBoardId === this.currentData()._id;
+ },
+
+ presentParentTask() {
+ let result = this.currentBoard.presentParentTask;
+ if ((result === null) || (result === undefined)) {
+ result = 'no-parent';
+ }
+ return result;
+ },
+
+ events() {
+ return [{
+ 'click .js-field-has-subtasks'(evt) {
+ evt.preventDefault();
+ this.currentBoard.allowsSubtasks = !this.currentBoard.allowsSubtasks;
+ this.currentBoard.setAllowsSubtasks(this.currentBoard.allowsSubtasks);
+ $('.js-field-has-subtasks .materialCheckBox').toggleClass('is-checked', this.currentBoard.allowsSubtasks);
+ $('.js-field-has-subtasks').toggleClass('is-checked', this.currentBoard.allowsSubtasks);
+ $('.js-field-deposit-board').prop('disabled', !this.currentBoard.allowsSubtasks);
+ },
+ 'change .js-field-deposit-board'(evt) {
+ let value = evt.target.value;
+ if (value === 'null') {
+ value = null;
+ }
+ this.currentBoard.setSubtasksDefaultBoardId(value);
+ evt.preventDefault();
+ },
+ 'change .js-field-deposit-list'(evt) {
+ this.currentBoard.setSubtasksDefaultListId(evt.target.value);
+ evt.preventDefault();
+ },
+ 'click .js-field-show-parent-in-minicard'(evt) {
+ const value = evt.target.id || $(evt.target).parent()[0].id || $(evt.target).parent()[0].parent()[0].id;
+ const options = [
+ 'prefix-with-full-path',
+ 'prefix-with-parent',
+ 'subtext-with-full-path',
+ 'subtext-with-parent',
+ 'no-parent'];
+ options.forEach(function(element) {
+ if (element !== value) {
+ $(`#${element} .materialCheckBox`).toggleClass('is-checked', false);
+ $(`#${element}`).toggleClass('is-checked', false);
+ }
+ });
+ $(`#${value} .materialCheckBox`).toggleClass('is-checked', true);
+ $(`#${value}`).toggleClass('is-checked', true);
+ this.currentBoard.setPresentParentTask(value);
+ evt.preventDefault();
+ },
+ }];
+ },
+}).register('boardSubtaskSettingsPopup');
+
const CreateBoard = BlazeComponent.extendComponent({
template() {
return 'createBoard';