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 selected: self.extra_properties && self.extra_properties.column == column.id
} [ column.title ] } [ column.title ]
color-to-form-selection = (self, color) -> color-to-form-selection = (self, color, current-color) ->
h \option { h \option {
value: color value: color
selected: self.extra_properties && self.extra_properties.color == color selected: current-color && current-color == color
} [ color ] } [ color ]
TaskCreationModal = (project, todod-ws, task) -> TaskCreationModal = (project, todod-ws, task) ->
@ -45,12 +45,12 @@ TaskCreationModal = (project, todod-ws, task) ->
description: task.description || "" description: task.description || ""
extra_properties: { extra_properties: {
column: "" column: ""
color: "" background-color: ""
} }
} }
# copy extra properties # 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 for k,v of task.extra_properties
console.log "extra_propertie: " + k + ", value: " + v console.log "extra_propertie: " + k + ", value: " + v
self.extra_properties[k] = 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 } 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 \div.select [
h \select { h \select {
onchange: (e) -> onchange: (e) ->
self.extra_properties.color := e.target.value self.extra_properties.background-color := e.target.value
} colors.map (color) -> color-to-form-selection self, color } 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 modal = void
self.render = -> self.render = ->
color = "grey" background-color = "grey"
if self.extra_properties && self.extra_properties.color if self.extra_properties && self.extra_properties.background-color
color = self.extra_properties.color background-color = self.extra_properties.background-color
h "div.card.has-background-#{color}" { h "div.card.has-background-#{background-color}" {
key: self.id key: self.id
} [ } [
h \div.card-content [ h \div.card-content [
h \div.media [ h \div.media [
h \div.media-left [ h \div.media-left [
# FIXME: assignee card image
"LEFT" "LEFT"
h \p [ "@coucou" ]
] ]
h \div.media-content [
self.title h \div.media-content [ self.title ]
]
h \div.button { h \div.button {
onclick: -> onclick: ->
modal := TaskCreationModal project, todod-ws, self modal := TaskCreationModal project, todod-ws, self
} [ "Edit" ] } [ "Edit" ]
h \div.button { h \div.button {
onclick: -> onclick: ->
modal := TaskRemovalModal project.id, todod-ws, self modal := TaskRemovalModal project.id, todod-ws, self
} [ "X" ] } [ "X" ]
] ]
h \div.content [ h \div.content [ self.description ]
self.description
]
] ]
if modal if modal
modal.render! modal.render!