Checklist, hide all checklist items possible, regardless if the checklist item is finished or not

This commit is contained in:
Martin Filser 2024-08-12 19:21:08 +02:00
parent bb17feaa17
commit 0783b733b0
4 changed files with 36 additions and 3 deletions

View file

@ -70,6 +70,13 @@ Checklists.attachSchema(
type: Boolean,
optional: true,
},
hideAllChecklistItems: {
/**
* hide all checklist items ?
*/
type: Boolean,
optional: true,
},
}),
);
@ -123,7 +130,11 @@ Checklists.helpers({
return ret;
},
isFinished() {
return 0 !== this.itemCount() && this.itemCount() === this.finishedCount();
let ret = this.hideAllChecklistItems;
if (!ret) {
ret = 0 !== this.itemCount() && this.itemCount() === this.finishedCount();
}
return ret;
},
showChecklist(hideFinishedChecklistIfItemsAreHidden) {
let ret = true;
@ -212,6 +223,13 @@ Checklists.mutations({
}
};
},
toggleHideAllChecklistItems() {
return {
$set: {
hideAllChecklistItems: !this.hideAllChecklistItems,
}
};
},
});
if (Meteor.isServer) {