mirror of
https://github.com/wekan/wekan.git
synced 2025-12-20 09:20:12 +01:00
added soft wip limit feature, fixed wipLimit=0 bug (??)
This commit is contained in:
parent
8bf3f300ad
commit
fdd1aad80d
5 changed files with 70 additions and 36 deletions
|
|
@ -49,23 +49,15 @@ Lists.attachSchema(new SimpleSchema({
|
|||
'wipLimit.value': {
|
||||
type: Number,
|
||||
decimal: false,
|
||||
autoValue() {
|
||||
if(this.isInsert){
|
||||
return 0;
|
||||
}
|
||||
return this.value;
|
||||
},
|
||||
optional: true,
|
||||
defaultValue: 1,
|
||||
},
|
||||
'wipLimit.enabled':{
|
||||
'wipLimit.enabled': {
|
||||
type: Boolean,
|
||||
autoValue() {
|
||||
if(this.isInsert){
|
||||
return false;
|
||||
}
|
||||
return this.value;
|
||||
},
|
||||
optional: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
'wipLimit.soft': {
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
}));
|
||||
|
||||
|
|
@ -123,6 +115,10 @@ Lists.mutations({
|
|||
return { $set: { archived: false } };
|
||||
},
|
||||
|
||||
toggleSoftLimit(toggle) {
|
||||
return { $set: { 'wipLimit.soft': toggle } };
|
||||
},
|
||||
|
||||
toggleWipLimit(toggle) {
|
||||
return { $set: { 'wipLimit.enabled': toggle } };
|
||||
},
|
||||
|
|
@ -136,17 +132,25 @@ Meteor.methods({
|
|||
applyWipLimit(listId, limit){
|
||||
check(listId, String);
|
||||
check(limit, Number);
|
||||
if(limit === 0){
|
||||
limit = 1;
|
||||
}
|
||||
Lists.findOne({ _id: listId }).setWipLimit(limit);
|
||||
},
|
||||
|
||||
enableWipLimit(listId) {
|
||||
check(listId, String);
|
||||
const list = Lists.findOne({ _id: listId });
|
||||
if(list.getWipLimit()){ // Necessary check to avoid exceptions for the case where the doc doesn't have the wipLimit field yet set
|
||||
list.toggleWipLimit(!list.getWipLimit('enabled'));
|
||||
} else {
|
||||
list.toggleWipLimit(true); // First time toggle is always to 'true' because default is 'false'
|
||||
if(list.getWipLimit('value') === 0){
|
||||
list.setWipLimit(1);
|
||||
}
|
||||
list.toggleWipLimit(!list.getWipLimit('enabled'));
|
||||
},
|
||||
|
||||
enableSoftLimit(listId) {
|
||||
check(listId, String);
|
||||
const list = Lists.findOne({ _id: listId });
|
||||
list.toggleSoftLimit(!list.getWipLimit('soft'));
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue