summaryrefslogtreecommitdiffstats
path: root/client/components/lists/listHeader.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/lists/listHeader.js')
-rw-r--r--client/components/lists/listHeader.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js
index 4b6bf196..923d6063 100644
--- a/client/components/lists/listHeader.js
+++ b/client/components/lists/listHeader.js
@@ -1,3 +1,8 @@
+let listsColors;
+Meteor.startup(() => {
+ listsColors = Lists.simpleSchema()._schema.color.allowedValues;
+});
+
BlazeComponent.extendComponent({
canSeeAddCard() {
const list = Template.currentData();
@@ -22,6 +27,16 @@ BlazeComponent.extendComponent({
return Meteor.user().getLimitToShowCardsCount();
},
+ cardsCount() {
+ const list = Template.currentData();
+ let swimlaneId = '';
+ const boardView = (Meteor.user().profile || {}).boardView;
+ if (boardView === 'board-view-swimlanes')
+ swimlaneId = this.parentComponent().parentComponent().data()._id;
+
+ return list.cards(swimlaneId).count();
+ },
+
reachedWipLimit() {
const list = Template.currentData();
return list.getWipLimit('enabled') && list.getWipLimit('value') <= list.cards().count();
@@ -62,6 +77,7 @@ Template.listActionPopup.helpers({
Template.listActionPopup.events({
'click .js-list-subscribe' () {},
+ 'click .js-set-color-list': Popup.open('setListColor'),
'click .js-select-cards' () {
const cardIds = this.allCards().map((card) => card._id);
MultiSelection.add(cardIds);
@@ -144,3 +160,34 @@ Template.listMorePopup.events({
Utils.goBoardId(this.boardId);
}),
});
+
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.currentList = this.currentData();
+ this.currentColor = new ReactiveVar(this.currentList.color);
+ },
+
+ colors() {
+ return listsColors.map((color) => ({ color, name: '' }));
+ },
+
+ isSelected(color) {
+ return this.currentColor.get() === color;
+ },
+
+ events() {
+ return [{
+ 'click .js-palette-color'() {
+ this.currentColor.set(this.currentData().color);
+ },
+ 'click .js-submit' () {
+ this.currentList.setColor(this.currentColor.get());
+ Popup.close();
+ },
+ 'click .js-remove-color'() {
+ this.currentList.setColor(null);
+ Popup.close();
+ },
+ }];
+ },
+}).register('setListColorPopup');