From 64a26976c4289ac8afced7629edd25a2cae3f443 Mon Sep 17 00:00:00 2001
From: Philippe PITTOLI
Date: Mon, 9 Dec 2019 03:31:11 +0100
Subject: [PATCH] background color
---
client/task-creation-modal.ls | 14 +++++++-------
client/task.ls | 21 +++++++++++----------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/client/task-creation-modal.ls b/client/task-creation-modal.ls
index b83dcf0..d04f3d9 100644
--- a/client/task-creation-modal.ls
+++ b/client/task-creation-modal.ls
@@ -30,10 +30,10 @@ column-form-selection = (self, column) ->
selected: self.extra_properties && self.extra_properties.column == column.id
} [ column.title ]
-color-to-form-selection = (self, color) ->
+color-to-form-selection = (self, color, current-color) ->
h \option {
value: color
- selected: self.extra_properties && self.extra_properties.color == color
+ selected: current-color && current-color == color
} [ color ]
TaskCreationModal = (project, todod-ws, task) ->
@@ -45,12 +45,12 @@ TaskCreationModal = (project, todod-ws, task) ->
description: task.description || ""
extra_properties: {
column: ""
- color: ""
+ background-color: ""
}
}
# copy extra properties
- # currently: column + color + assignee + expected duration time
+ # currently: column + background-color + assignee + expected duration time
for k,v of task.extra_properties
console.log "extra_propertie: " + k + ", value: " + v
self.extra_properties[k] = v
@@ -82,13 +82,13 @@ TaskCreationModal = (project, todod-ws, task) ->
} project.extra_properties.columns.map (column) -> column-form-selection self, column
]
- h \p [ "Choose the color" ]
+ h \p [ "Choose the background color" ]
h \div.select [
h \select {
onchange: (e) ->
- self.extra_properties.color := e.target.value
- } colors.map (color) -> color-to-form-selection self, color
+ self.extra_properties.background-color := e.target.value
+ } colors.map (color) -> color-to-form-selection self, color, self.extra_properties.background-color
]
]
diff --git a/client/task.ls b/client/task.ls
index 169544e..e9306fb 100644
--- a/client/task.ls
+++ b/client/task.ls
@@ -36,33 +36,34 @@ Task = (self, project, todod-ws) ->
modal = void
self.render = ->
- color = "grey"
- if self.extra_properties && self.extra_properties.color
- color = self.extra_properties.color
+ background-color = "grey"
+ if self.extra_properties && self.extra_properties.background-color
+ background-color = self.extra_properties.background-color
- h "div.card.has-background-#{color}" {
+ h "div.card.has-background-#{background-color}" {
key: self.id
} [
h \div.card-content [
h \div.media [
h \div.media-left [
+ # FIXME: assignee card image
"LEFT"
+ h \p [ "@coucou" ]
]
- h \div.media-content [
- self.title
- ]
+
+ h \div.media-content [ self.title ]
+
h \div.button {
onclick: ->
modal := TaskCreationModal project, todod-ws, self
} [ "Edit" ]
+
h \div.button {
onclick: ->
modal := TaskRemovalModal project.id, todod-ws, self
} [ "X" ]
]
- h \div.content [
- self.description
- ]
+ h \div.content [ self.description ]
]
if modal
modal.render!