From fdd1aad80de336061d576b99d86fc94694131af6 Mon Sep 17 00:00:00 2001 From: amadilsons Date: Tue, 31 Oct 2017 21:10:36 +0000 Subject: added soft wip limit feature, fixed wipLimit=0 bug (??) --- client/components/lists/list.styl | 9 +++++++++ client/components/lists/listBody.js | 3 +-- client/components/lists/listHeader.jade | 16 ++++++++++----- client/components/lists/listHeader.js | 36 ++++++++++++++++++++++++--------- 4 files changed, 47 insertions(+), 17 deletions(-) (limited to 'client') diff --git a/client/components/lists/list.styl b/client/components/lists/list.styl index f426b243..b7bc33e8 100644 --- a/client/components/lists/list.styl +++ b/client/components/lists/list.styl @@ -79,6 +79,9 @@ .list-header-plus-icon color: #a6a6a6 + .highlight + color: #ce1414 + .list-body flex: 1 display: flex @@ -126,3 +129,9 @@ .wip-limit-error display: none + + .soft-wip-limit + margin-right: 8px + + div + float: left diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 22ed9e57..fe2f1630 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -102,8 +102,7 @@ BlazeComponent.extendComponent({ reachedWipLimit() { const list = Template.currentData(); - if( !list.getWipLimit() ) { return false; } - return list.getWipLimit('enabled') && list.getWipLimit('value') === list.cards().count(); + return !list.getWipLimit('soft') && list.getWipLimit('enabled') && list.getWipLimit('value') <= list.cards().count(); }, events() { diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade index e1d2f9f4..30ed01f3 100644 --- a/client/components/lists/listHeader.jade +++ b/client/components/lists/listHeader.jade @@ -5,10 +5,12 @@ template(name="listHeader") else h2.list-header-name( class="{{#if currentUser.isBoardMember}}js-open-inlined-form is-editable{{/if}}") - = title - if isWipLimitEnabled - span - | ({{cards.count}}/#{wipLimit.value}) + = title + if wipLimit.enabled + | ( + span(class="{{#if reachedWipLimit}}highlight{{/if}}") {{cards.count}} + |/#{wipLimit.value}) + if showCardsCountForList cards.count = cards.count span.lowercase @@ -18,7 +20,7 @@ template(name="listHeader") i.list-header-watch-icon.fa.fa-eye div.list-header-menu unless currentUser.isCommentOnly - unless isWipLimitEnabled + if canSeeAddCard a.js-add-card.fa.fa-plus.list-header-plus-icon a.fa.fa-navicon.js-open-list-menu @@ -86,6 +88,10 @@ template(name="setWipLimitPopup") input.wip-limit-value(type="number" value="{{ wipLimitValue }}" min="1" max="99") input.wip-limit-apply(type="submit" value="{{_ 'apply'}}") input.wip-limit-error + p + .soft-wip-limit + .materialCheckBox(class="{{#if isWipLimitSoft}}is-checked{{/if}}") + label Soft Limit template(name="wipLimitErrorPopup") .wip-limit-invalid 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'); -- cgit v1.2.3-1-g7c22 From e015e4245e5e7db832578b9786516f4ae4723ff5 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 2 Nov 2017 01:03:51 +0200 Subject: Make it possible to translate text Soft WIP Limit. --- client/components/lists/listHeader.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client') diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade index 30ed01f3..4bbc023c 100644 --- a/client/components/lists/listHeader.jade +++ b/client/components/lists/listHeader.jade @@ -91,7 +91,7 @@ template(name="setWipLimitPopup") p .soft-wip-limit .materialCheckBox(class="{{#if isWipLimitSoft}}is-checked{{/if}}") - label Soft Limit + label {{_ 'soft-wip-limit'}} template(name="wipLimitErrorPopup") .wip-limit-invalid -- cgit v1.2.3-1-g7c22