summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authordollybean <herbalproducts.ist@gmail.com>2020-02-04 02:28:45 -0800
committerdollybean <herbalproducts.ist@gmail.com>2020-02-04 02:28:45 -0800
commit0b00a8095ce34c753e5edac86d4b62e8aaa1b1e0 (patch)
tree11307a99c48966d5695466d359b48f88c0c31b0d /models
parent85d47c4ff2c625331540d7cbc7f499c41df6d3b8 (diff)
downloadwekan-0b00a8095ce34c753e5edac86d4b62e8aaa1b1e0.tar.gz
wekan-0b00a8095ce34c753e5edac86d4b62e8aaa1b1e0.tar.bz2
wekan-0b00a8095ce34c753e5edac86d4b62e8aaa1b1e0.zip
Customize of some card's functions
Diffstat (limited to 'models')
-rw-r--r--models/boards.js117
1 files changed, 117 insertions, 0 deletions
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 } };
},