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 --- models/boards.js | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'models') diff --git a/models/boards.js b/models/boards.js index 4e193dc7..121272ec 100644 --- a/models/boards.js +++ b/models/boards.js @@ -278,6 +278,7 @@ Boards.attachSchema( optional: true, defaultValue: null, }, + subtasksDefaultListId: { /** * The default List ID assigned to subtasks. @@ -286,6 +287,19 @@ Boards.attachSchema( optional: true, defaultValue: null, }, + + dateSettingsDefaultBoardId: { + type: String, + optional: true, + defaultValue: null, + }, + + dateSettingsDefaultListId: { + type: String, + optional: true, + defaultValue: null, + }, + allowsSubtasks: { /** * Does the board allows subtasks? @@ -293,6 +307,39 @@ Boards.attachSchema( type: Boolean, defaultValue: true, }, + + allowsReceivedDate: { + /** + * Does the board allows received date? + */ + type: Boolean, + defaultValue: true, + }, + + allowsStartDate: { + /** + * Does the board allows start date? + */ + type: Boolean, + defaultValue: true, + }, + + allowsEndDate: { + /** + * Does the board allows end date? + */ + type: Boolean, + defaultValue: true, + }, + + allowsDueDate: { + /** + * Does the board allows due date? + */ + type: Boolean, + defaultValue: true, + }, + presentParentTask: { /** * Controls how to present the parent task: @@ -710,6 +757,39 @@ Boards.helpers({ return Boards.findOne(this.getDefaultSubtasksBoardId()); }, +//Date Settings option such as received date, start date and so on. + getDefaultDateSettingsBoardId() { + if ( + this.dateSettingsDefaultBoardId === null || + this.dateSettingsDefaultBoardId === undefined + ) { + this.dateSettingsDefaultBoardId = Boards.insert({ + title: `^${this.title}^`, + permission: this.permission, + members: this.members, + color: this.color, + description: TAPi18n.__('default-dates-board', { + board: this.title, + }), + }); + + Swimlanes.insert({ + title: TAPi18n.__('default'), + boardId: this.dateSettingsDefaultBoardId, + }); + Boards.update(this._id, { + $set: { + dateSettingsDefaultBoardId: this.dateSettingsDefaultBoardId, + }, + }); + } + return this.dateSettingsDefaultBoardId; + }, + + getDefaultDateSettingsBoard() { + return Boards.findOne(this.getDefaultDateSettingsBoardId()); + }, + getDefaultSubtasksListId() { if ( this.subtasksDefaultListId === null || @@ -728,6 +808,24 @@ Boards.helpers({ return Lists.findOne(this.getDefaultSubtasksListId()); }, + getDefaultDateSettingsListId() { + if ( + this.dateSettingsDefaultListId === null || + this.dateSettingsDefaultListId === undefined + ) { + this.dateSettingsDefaultListId = Lists.insert({ + title: TAPi18n.__('queue'), + boardId: this._id, + }); + this.setDateSettingsDefaultListId(this.dateSettingsDefaultListId); + } + return this.dateSettingsDefaultListId; + }, + + getDefaultDateSettingsList() { + return Lists.findOne(this.getDefaultDateSettingsListId()); + }, + getDefaultSwimline() { let result = Swimlanes.findOne({ boardId: this._id }); if (result === undefined) { @@ -925,6 +1023,25 @@ Boards.mutations({ return { $set: { allowsSubtasks } }; }, + setAllowsReceivedDate(allowsReceivedDate) { + return { $set: { allowsReceivedDate } }; + }, + + + setAllowsStartDate(allowsStartDate) { + return { $set: { allowsStartDate } }; + }, + + + setAllowsEndDate(allowsEndDate) { + return { $set: { allowsEndDate } }; + }, + + + setAllowsDueDate(allowsDueDate) { + return { $set: { allowsDueDate } }; + }, + setSubtasksDefaultBoardId(subtasksDefaultBoardId) { return { $set: { subtasksDefaultBoardId } }; }, -- cgit v1.2.3-1-g7c22