Task cards now have a color.

master
Luka Vandervelden 2019-07-08 06:31:13 +02:00
parent bb8fb3ec1f
commit 84ca28f322
5 changed files with 45 additions and 3 deletions

View File

@ -49,7 +49,7 @@ Task = (self, project) ->
is-selected = model.selected == self.id
h \div.card {
h (\div.card.is- + (self.color || "dark")), {
key: self.id
classes: {
"is-selected": is-selected
@ -175,6 +175,31 @@ Task = (self, project) ->
} [ "Assign" ]
]
if is-selected
h \div.card-footer {key: "color"} [
if model.editing == self.id + ".color"
h \div.card-footer-item {
key: "color.clicked"
} [
h \input.input {
onchange: (e) ->
model.editing := undefined
socket.send JSON.stringify {
type: "edit-task"
project: project.id
task: self.id
color: e.target.value
}
}
]
else
h \div.card-footer-item {
key: "assign"
onclick: ->
model.editing := self.id + ".color"
} [ "Change Color" ]
]
if is-selected
h \div.card-footer {key: "move"} [
h \div.card-footer-item {

View File

@ -25,3 +25,10 @@
.project
margin-top: 12px
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
.card.is-#{$name}
background-color: darken($color, 30)

View File

@ -184,6 +184,10 @@ ws "/socket" do |socket|
task.description = description
end
if color = request.color
task.color = color
end
# FIXME: Check its a valid UID.
if assigned_to = request.assigned_to
# FIXME: Probably not the best way to handle this corner-case.

View File

@ -57,7 +57,8 @@ class Requests::EditTask
column: String?,
title: String?,
description: String?,
assigned_to: Int32?
assigned_to: Int32?,
color: String?
})
end

View File

@ -7,11 +7,16 @@ class Task
title: String,
description: String,
column: String,
assigned_to: Int32?
assigned_to: Int32?,
color: {
type: String,
default: "dark"
}
})
def initialize(@title, @author, @description, @column)
@id = UUID.random.to_s
@color = "dark"
end
end