summaryrefslogtreecommitdiffstats
path: root/client/components/lists/listHeader.js
diff options
context:
space:
mode:
authoramadilsons <joao.amado.95@gmail.com>2017-10-31 21:10:36 +0000
committeramadilsons <joao.amado.95@gmail.com>2017-10-31 21:10:36 +0000
commitfdd1aad80de336061d576b99d86fc94694131af6 (patch)
tree9012a3020cb724d37c7466d650912d9c9afc0cae /client/components/lists/listHeader.js
parent8bf3f300ad46cf13f17176b0986a72c88191fbb1 (diff)
downloadwekan-fdd1aad80de336061d576b99d86fc94694131af6.tar.gz
wekan-fdd1aad80de336061d576b99d86fc94694131af6.tar.bz2
wekan-fdd1aad80de336061d576b99d86fc94694131af6.zip
added soft wip limit feature, fixed wipLimit=0 bug (??)
Diffstat (limited to 'client/components/lists/listHeader.js')
-rw-r--r--client/components/lists/listHeader.js36
1 files changed, 26 insertions, 10 deletions
diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js
index 9974c788..04dba683 100644
--- a/client/components/lists/listHeader.js
+++ b/client/components/lists/listHeader.js
@@ -1,4 +1,9 @@
BlazeComponent.extendComponent({
+ canSeeAddCard() {
+ const list = Template.currentData();
+ return !list.getWipLimit('enabled') || list.getWipLimit('soft') || !this.reachedWipLimit();
+ },
+
editTitle(evt) {
evt.preventDefault();
const newTitle = this.childComponents('inlinedForm')[0].getValue().trim();
@@ -13,18 +18,15 @@ BlazeComponent.extendComponent({
return list.findWatcher(Meteor.userId());
},
- isWipLimitEnabled() {
- const wipLimit = this.currentData().getWipLimit();
- if(!wipLimit) {
- return 0;
- }
- return wipLimit.enabled && wipLimit.value > 0;
- },
-
limitToShowCardsCount() {
return Meteor.user().getLimitToShowCardsCount();
},
+ reachedWipLimit() {
+ const list = Template.currentData();
+ return list.getWipLimit('enabled') && list.getWipLimit('value') <= list.cards().count();
+ },
+
showCardsCountForList(count) {
return count > this.limitToShowCardsCount();
},
@@ -82,7 +84,7 @@ BlazeComponent.extendComponent({
const list = Template.currentData();
const limit = parseInt(Template.instance().$('.wip-limit-value').val(), 10);
- if(limit < list.cards().count()){
+ if(limit < list.cards().count() && !list.getWipLimit('soft')){
Template.instance().$('.wip-limit-error').click();
} else {
Meteor.call('applyWipLimit', list._id, limit);
@@ -90,15 +92,28 @@ BlazeComponent.extendComponent({
}
},
+ enableSoftLimit() {
+ const list = Template.currentData();
+
+ if(list.getWipLimit('soft') && list.getWipLimit('value') < list.cards().count()){
+ list.setWipLimit(list.cards().count());
+ }
+ Meteor.call('enableSoftLimit', Template.currentData()._id);
+ },
+
enableWipLimit() {
const list = Template.currentData();
// Prevent user from using previously stored wipLimit.value if it is less than the current number of cards in the list
- if(list.getWipLimit() && !list.getWipLimit('enabled') && list.getWipLimit('value') < list.cards().count()){
+ if(!list.getWipLimit('enabled') && list.getWipLimit('value') < list.cards().count()){
list.setWipLimit(list.cards().count());
}
Meteor.call('enableWipLimit', list._id);
},
+ isWipLimitSoft() {
+ return Template.currentData().getWipLimit('soft');
+ },
+
isWipLimitEnabled() {
return Template.currentData().getWipLimit('enabled');
},
@@ -112,6 +127,7 @@ BlazeComponent.extendComponent({
'click .js-enable-wip-limit': this.enableWipLimit,
'click .wip-limit-apply': this.applyWipLimit,
'click .wip-limit-error': Popup.open('wipLimitError'),
+ 'click .materialCheckBox': this.enableSoftLimit,
}];
},
}).register('setWipLimitPopup');