summaryrefslogtreecommitdiffstats
path: root/client/components/cards/cardDetails.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-01-22 17:33:27 +0200
committerLauri Ojansivu <x@xet7.org>2019-01-22 17:33:27 +0200
commit46a468b06dd5d4ca2338140bb2fd32958ccef85f (patch)
tree9a7656c0fa92c0895c25d958764f090c74d0c129 /client/components/cards/cardDetails.js
parent8d4eef66493f464035616fec7ac8b2f14720ce57 (diff)
parent1b445ad789a41d97b7cf4e16af35f52ae0be694b (diff)
downloadwekan-46a468b06dd5d4ca2338140bb2fd32958ccef85f.tar.gz
wekan-46a468b06dd5d4ca2338140bb2fd32958ccef85f.tar.bz2
wekan-46a468b06dd5d4ca2338140bb2fd32958ccef85f.zip
Merge branch 'edge' into meteor-1.8
Diffstat (limited to 'client/components/cards/cardDetails.js')
-rw-r--r--client/components/cards/cardDetails.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index e17e7467..cc04b830 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];
@@ -22,6 +27,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) {
@@ -337,6 +343,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));
@@ -586,6 +593,37 @@ Template.copyChecklistToManyCardsPopup.events({
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() {
+ this.currentCard = this.currentData();
this.parentCard = this.currentCard.parentCard();
if (this.parentCard) {
this.parentBoard = this.parentCard.board();