Customize of some card's functions

This commit is contained in:
dollybean 2020-02-04 02:28:45 -08:00
parent 85d47c4ff2
commit 0b00a8095c
21 changed files with 582 additions and 254 deletions

View file

@ -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 } };
},