From b0ac10d94a8200a1ad0199a82c3f9d9be7ac9882 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 24 Jul 2018 18:18:40 +0200 Subject: Add the ability to change the card background Currently the only way to set it is via the REST API --- client/components/cards/cardDetails.js | 1 + 1 file changed, 1 insertion(+) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index e17e7467..060ded5a 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -22,6 +22,7 @@ BlazeComponent.extendComponent({ onCreated() { this.currentBoard = Boards.findOne(Session.get('currentBoard')); this.isLoaded = new ReactiveVar(false); + this.currentColor = new ReactiveVar(this.data().color); const boardBody = this.parentComponent().parentComponent(); //in Miniview parent is Board, not BoardBody. if (boardBody !== null) { -- cgit v1.2.3-1-g7c22 From 3368ebf067779d1f306a2447e2357e34213f0126 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 22 Jan 2019 10:35:09 +0100 Subject: color: add option in hamburger to change the card color Currently only dropdown, no palette Fixes: #428 --- client/components/cards/cardDetails.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 060ded5a..7883f129 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -338,6 +338,7 @@ Template.cardDetailsActionsPopup.events({ 'click .js-move-card': Popup.open('moveCard'), 'click .js-copy-card': Popup.open('copyCard'), 'click .js-copy-checklist-cards': Popup.open('copyChecklistToManyCards'), + 'click .js-set-card-color': Popup.open('setCardColor'), 'click .js-move-card-to-top' (evt) { evt.preventDefault(); const minOrder = _.min(this.list().cards(this.swimlaneId).map((c) => c.sort)); @@ -584,6 +585,18 @@ Template.copyChecklistToManyCardsPopup.events({ }, }); +Template.setCardColorPopup.events({ + 'click .js-submit' () { + // XXX We should *not* get the currentCard from the global state, but + // instead from a “component” state. + const card = Cards.findOne(Session.get('currentCard')); + const colorSelect = $('.js-select-colors')[0]; + newColor = colorSelect.options[colorSelect.selectedIndex].value; + card.setColor(newColor); + Popup.close(); + }, +}); + BlazeComponent.extendComponent({ onCreated() { this.currentCard = this.currentData(); -- cgit v1.2.3-1-g7c22 From 2082480ddd91343250d0fc8752750bd8801b45da Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 22 Jan 2019 13:38:08 +0100 Subject: Set the card color with the color picker When triggered from the hamburger --- client/components/cards/cardDetails.js | 44 ++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 7883f129..c936f0f4 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -1,6 +1,11 @@ const subManager = new SubsManager(); const { calculateIndexData, enableClickOnTouch } = Utils; +let cardColors; +Meteor.startup(() => { + cardColors = Cards.simpleSchema()._schema['color'].allowedValues; +}); + BlazeComponent.extendComponent({ mixins() { return [Mixins.InfiniteScrolling, Mixins.PerfectScrollbar]; @@ -585,17 +590,36 @@ Template.copyChecklistToManyCardsPopup.events({ }, }); -Template.setCardColorPopup.events({ - 'click .js-submit' () { - // XXX We should *not* get the currentCard from the global state, but - // instead from a “component” state. - const card = Cards.findOne(Session.get('currentCard')); - const colorSelect = $('.js-select-colors')[0]; - newColor = colorSelect.options[colorSelect.selectedIndex].value; - card.setColor(newColor); - Popup.close(); +BlazeComponent.extendComponent({ + onCreated() { + this.currentCard = this.currentData(); + this.currentColor = new ReactiveVar(this.currentCard.color); }, -}); + + colors() { + return cardColors.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.currentCard.setColor(this.currentColor.get()); + Popup.close(); + }, + 'click .js-remove-color'() { + this.currentCard.setColor(null); + Popup.close(); + }, + }]; + }, +}).register('setCardColorPopup'); BlazeComponent.extendComponent({ onCreated() { -- cgit v1.2.3-1-g7c22 From 44e4df2492b95226f1297e7f556d61b1afaab714 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 22 Jan 2019 15:22:31 +0200 Subject: - Translate and add colors to IFTTT Rules dropdown. Thanks to xet7 ! --- client/components/cards/cardDetails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index c936f0f4..cc04b830 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -3,7 +3,7 @@ const { calculateIndexData, enableClickOnTouch } = Utils; let cardColors; Meteor.startup(() => { - cardColors = Cards.simpleSchema()._schema['color'].allowedValues; + cardColors = Cards.simpleSchema()._schema.color.allowedValues; }); BlazeComponent.extendComponent({ -- cgit v1.2.3-1-g7c22