diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-24 16:47:09 +0100 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-25 11:04:40 +0100 |
commit | 03efeaeb1abae0c8c39ad5644d44bad36f415d99 (patch) | |
tree | be24b13d24bbcf400c26ca88923383abe6d86993 /client/components/swimlanes/swimlaneHeader.js | |
parent | c075187088e69d30db31489d75b22f991e1972ff (diff) | |
download | wekan-03efeaeb1abae0c8c39ad5644d44bad36f415d99.tar.gz wekan-03efeaeb1abae0c8c39ad5644d44bad36f415d99.tar.bz2 wekan-03efeaeb1abae0c8c39ad5644d44bad36f415d99.zip |
Add colors to swimlanes
fixes #1688
Diffstat (limited to 'client/components/swimlanes/swimlaneHeader.js')
-rw-r--r-- | client/components/swimlanes/swimlaneHeader.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/client/components/swimlanes/swimlaneHeader.js b/client/components/swimlanes/swimlaneHeader.js index 632a0f50..1004cb25 100644 --- a/client/components/swimlanes/swimlaneHeader.js +++ b/client/components/swimlanes/swimlaneHeader.js @@ -1,5 +1,10 @@ const { calculateIndexData } = Utils; +let swimlaneColors; +Meteor.startup(() => { + swimlaneColors = Swimlanes.simpleSchema()._schema.color.allowedValues; +}); + BlazeComponent.extendComponent({ editTitle(evt) { evt.preventDefault(); @@ -20,6 +25,7 @@ BlazeComponent.extendComponent({ }).register('swimlaneHeader'); Template.swimlaneActionPopup.events({ + 'click .js-set-swimlane-color': Popup.open('setSwimlaneColor'), 'click .js-close-swimlane' (evt) { evt.preventDefault(); this.archive(); @@ -60,3 +66,34 @@ BlazeComponent.extendComponent({ }]; }, }).register('swimlaneAddPopup'); + +BlazeComponent.extendComponent({ + onCreated() { + this.currentSwimlane = this.currentData(); + this.currentColor = new ReactiveVar(this.currentSwimlane.color); + }, + + colors() { + return swimlaneColors.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.currentSwimlane.setColor(this.currentColor.get()); + Popup.close(); + }, + 'click .js-remove-color'() { + this.currentSwimlane.setColor(null); + Popup.close(); + }, + }]; + }, +}).register('setSwimlaneColorPopup'); |