summaryrefslogtreecommitdiffstats
path: root/client/components/lists/listHeader.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-10-09 14:49:38 +0300
committerLauri Ojansivu <x@xet7.org>2017-10-09 14:49:38 +0300
commitfb060ed2c52ee80d9f25d9e8431280b092f74da0 (patch)
tree3e325e5f2d19b72811c596727ca67e02d7b47f4a /client/components/lists/listHeader.js
parentc84187bdadb7f1afaa8211773d1d1cb986709099 (diff)
parentf77da76c682ec7ad1b5e141d113d4b74371f46ae (diff)
downloadwekan-fb060ed2c52ee80d9f25d9e8431280b092f74da0.tar.gz
wekan-fb060ed2c52ee80d9f25d9e8431280b092f74da0.tar.bz2
wekan-fb060ed2c52ee80d9f25d9e8431280b092f74da0.zip
Merge branch 'issue783' of https://github.com/amadilsons/wekan into amadilsons-issue783
Diffstat (limited to 'client/components/lists/listHeader.js')
-rw-r--r--client/components/lists/listHeader.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js
index 7fe42884..9974c788 100644
--- a/client/components/lists/listHeader.js
+++ b/client/components/lists/listHeader.js
@@ -13,6 +13,14 @@ 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();
},
@@ -37,6 +45,10 @@ BlazeComponent.extendComponent({
}).register('listHeader');
Template.listActionPopup.helpers({
+ isWipLimitEnabled() {
+ return Template.currentData().getWipLimit('enabled');
+ },
+
isWatching() {
return this.findWatcher(Meteor.userId());
},
@@ -61,9 +73,49 @@ Template.listActionPopup.events({
this.archive();
Popup.close();
},
+ 'click .js-set-wip-limit': Popup.open('setWipLimit'),
'click .js-more': Popup.open('listMore'),
});
+BlazeComponent.extendComponent({
+ applyWipLimit() {
+ const list = Template.currentData();
+ const limit = parseInt(Template.instance().$('.wip-limit-value').val(), 10);
+
+ if(limit < list.cards().count()){
+ Template.instance().$('.wip-limit-error').click();
+ } else {
+ Meteor.call('applyWipLimit', list._id, limit);
+ Popup.back();
+ }
+ },
+
+ 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()){
+ list.setWipLimit(list.cards().count());
+ }
+ Meteor.call('enableWipLimit', list._id);
+ },
+
+ isWipLimitEnabled() {
+ return Template.currentData().getWipLimit('enabled');
+ },
+
+ wipLimitValue(){
+ return Template.currentData().getWipLimit('value');
+ },
+
+ events() {
+ return [{
+ 'click .js-enable-wip-limit': this.enableWipLimit,
+ 'click .wip-limit-apply': this.applyWipLimit,
+ 'click .wip-limit-error': Popup.open('wipLimitError'),
+ }];
+ },
+}).register('setWipLimitPopup');
+
Template.listMorePopup.events({
'click .js-delete': Popup.afterConfirm('listDelete', function () {
Popup.close();