From 0b00a8095ce34c753e5edac86d4b62e8aaa1b1e0 Mon Sep 17 00:00:00 2001 From: dollybean Date: Tue, 4 Feb 2020 02:28:45 -0800 Subject: Customize of some card's functions --- client/components/sidebar/sidebar.jade | 29 ++++++++ client/components/sidebar/sidebar.js | 125 +++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) (limited to 'client/components/sidebar') diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index 8e84cd61..fc5ff3a6 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -72,6 +72,25 @@ template(name="boardChangeColorPopup") if isSelected i.fa.fa-check +template(name="boardDateSettingsPopup") + form.board-Date-settings + div.check-div + a.flex.js-field-has-receiveddate(class="{{#if allowsReceivedDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsReceivedDate}}is-checked{{/if}}") + span {{_ 'show-receiveddate-field'}} + div.check-div + a.flex.js-field-has-startdate(class="{{#if allowsStartDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsStartDate}}is-checked{{/if}}") + span {{_ 'show-startdate-field'}} + div.check-div + a.flex.js-field-has-enddate(class="{{#if allowsEndDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsEndDate}}is-checked{{/if}}") + span {{_ 'show-enddate-field'}} + div.check-div + a.flex.js-field-has-duedate(class="{{#if allowsDueDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsDueDate}}is-checked{{/if}}") + span {{_ 'show-duedate-field'}} + template(name="boardSubtaskSettingsPopup") form.board-subtask-settings h3 {{_ 'show-parent-in-minicard'}} @@ -201,6 +220,10 @@ template(name="boardMenuPopup") a.js-subtask-settings i.fa.fa-sitemap | {{_ 'subtask-settings'}} + li + a.js-Date-settings + i.fa.fa-calendar + | {{_ 'Date-settings'}} unless currentBoard.isTemplatesBoard hr ul.pop-over-list @@ -238,6 +261,12 @@ template(name="boardMenuPopup") a.js-subtask-settings i.fa.fa-sitemap | {{_ 'subtask-settings'}} + hr + ul.pop-over-list + li + a.js-Date-settings + i.fa.fa-calendar + | {{_ 'Date-settings'}} template(name="labelsWidget") .board-widget.board-widget-labels diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index e8f38b8c..d909a8ae 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -208,6 +208,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'), + 'click .js-Date-settings': Popup.open('boardDateSettings') }); Template.boardMenuPopup.helpers({ @@ -585,6 +586,130 @@ BlazeComponent.extendComponent({ }, }).register('boardSubtaskSettingsPopup'); +BlazeComponent.extendComponent({ + onCreated(){ + this.currentBoard = Boards.findOne(Session.get('currentBoard')); + }, + + allowsReceivedDate(){ + return this.currentBoard.allowsReceivedDate; + }, + + allowsStartDate(){ + return this.currentBoard.allowsStartDate; + }, + + allowsEndDate(){ + return this.currentBoard.allowsEndDate; + }, + + allowsDueDate(){ + return this.currentBoard.allowsDueDate; + }, + + isBoardSelected(){ + return this.currentBoard.dateSettingsDefaultBoardID + }, + + isNullBoardSelected() { + return ( + this.currentBoard.dateSettingsDefaultBoardId === null || + this.currentBoard.dateSettingsDefaultBoardId === 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.dateSettingsDefaultBoardId === this.currentData()._id; + }, + + events() { + return [ + { + 'click .js-field-has-receiveddate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsReceivedDate = !this.currentBoard.allowsReceivedDate; + this.currentBoard.setAllowsReceivedDate(this.currentBoard.allowsReceivedDate); + $(`.js-field-has-receiveddate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsReceivedDate, + ); + $('.js-field-has-receiveddate').toggleClass( + CKCLS, + this.currentBoard.allowsReceivedDate, + ); + }, + 'click .js-field-has-startdate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsStartDate = !this.currentBoard.allowsStartDate; + this.currentBoard.setAllowsStartDate(this.currentBoard.allowsStartDate); + $(`.js-field-has-startdate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsStartDate, + ); + $('.js-field-has-startdate').toggleClass( + CKCLS, + this.currentBoard.allowsStartDate, + ); + }, + 'click .js-field-has-enddate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsEndDate = !this.currentBoard.allowsEndDate; + this.currentBoard.setAllowsEndDate(this.currentBoard.allowsEndDate); + $(`.js-field-has-enddate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsEndDate, + ); + $('.js-field-has-enddate').toggleClass( + CKCLS, + this.currentBoard.allowsEndDate, + ); + }, + 'click .js-field-has-duedate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsDueDate = !this.currentBoard.allowsDueDate; + this.currentBoard.setAllowsDueDate(this.currentBoard.allowsDueDate); + $(`.js-field-has-duedate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsDueDate, + ); + $('.js-field-has-duedate').toggleClass( + CKCLS, + this.currentBoard.allowsDueDate, + ); + }, + }, + ]; + }, +}).register('boardDateSettingsPopup'); + BlazeComponent.extendComponent({ onCreated() { this.error = new ReactiveVar(''); -- cgit v1.2.3-1-g7c22