background color

This commit is contained in:
Philippe PITTOLI 2019-12-09 03:31:11 +01:00
parent 755861eccc
commit 64a26976c4
2 changed files with 18 additions and 17 deletions

View File

@ -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
]
]

View File

@ -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!