mirror of
https://github.com/wekan/wekan.git
synced 2026-02-24 00:44:07 +01:00
Initial implementation for subtasks
This commit is contained in:
parent
b627ced605
commit
d59583915c
13 changed files with 478 additions and 34 deletions
|
|
@ -44,6 +44,9 @@ Activities.helpers({
|
|||
checklistItem() {
|
||||
return ChecklistItems.findOne(this.checklistItemId);
|
||||
},
|
||||
subtasks() {
|
||||
return Subtasks.findOne(this.subtaskId);
|
||||
},
|
||||
customField() {
|
||||
return CustomFields.findOne(this.customFieldId);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -215,6 +215,27 @@ Cards.helpers({
|
|||
return this.checklistItemCount() !== 0;
|
||||
},
|
||||
|
||||
subtasks() {
|
||||
return Subtasks.find({cardId: this._id}, {sort: { sort: 1 } });
|
||||
},
|
||||
|
||||
subtasksCount() {
|
||||
return Subtasks.find({cardId: this._id}).count();
|
||||
},
|
||||
|
||||
subtasksFinishedCount() {
|
||||
return Subtasks.find({cardId: this._id, isFinished: true}).count();
|
||||
},
|
||||
|
||||
subtasksFinished() {
|
||||
const finishCount = this.subtasksFinishedCount();
|
||||
return finishCount > 0 && this.subtasksCount() === finishCount;
|
||||
},
|
||||
|
||||
hasSubtasks() {
|
||||
return this.subtasksCount() !== 0;
|
||||
},
|
||||
|
||||
customFieldIndex(customFieldId) {
|
||||
return _.pluck(this.customFields, '_id').indexOf(customFieldId);
|
||||
},
|
||||
|
|
@ -513,6 +534,9 @@ function cardRemover(userId, doc) {
|
|||
Checklists.remove({
|
||||
cardId: doc._id,
|
||||
});
|
||||
Subtasks.remove({
|
||||
cardId: doc._id,
|
||||
});
|
||||
CardComments.remove({
|
||||
cardId: doc._id,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,9 +58,11 @@ class Exporter {
|
|||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||
result.checklists = [];
|
||||
result.checklistItems = [];
|
||||
result.subtaskItems = [];
|
||||
result.cards.forEach((card) => {
|
||||
result.checklists.push(...Checklists.find({ cardId: card._id }).fetch());
|
||||
result.checklistItems.push(...ChecklistItems.find({ cardId: card._id }).fetch());
|
||||
result.subtaskItems.push(...Subtasks.find({ cardId: card._id }).fetch());
|
||||
});
|
||||
|
||||
// [Old] for attachments we only export IDs and absolute url to original doc
|
||||
|
|
|
|||
|
|
@ -41,13 +41,7 @@ Subtasks.attachSchema(new SimpleSchema({
|
|||
}));
|
||||
|
||||
Subtasks.helpers({
|
||||
isFinished() {
|
||||
return 0 !== this.itemCount() && this.itemCount() === this.finishedCount();
|
||||
},
|
||||
itemIndex(itemId) {
|
||||
const items = self.findOne({_id : this._id}).items;
|
||||
return _.pluck(items, '_id').indexOf(itemId);
|
||||
},
|
||||
// ...
|
||||
});
|
||||
|
||||
Subtasks.allow({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue