Task cards now have a color.
parent
bb8fb3ec1f
commit
84ca28f322
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -184,6 +184,10 @@ ws "/socket" do |socket|
|
|||
task.description = description
|
||||
end
|
||||
|
||||
if color = request.color
|
||||
task.color = color
|
||||
end
|
||||
|
||||
# FIXME: Check it’s a valid UID.
|
||||
if assigned_to = request.assigned_to
|
||||
# FIXME: Probably not the best way to handle this corner-case.
|
||||
|
|
|
@ -57,7 +57,8 @@ class Requests::EditTask
|
|||
column: String?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
assigned_to: Int32?
|
||||
assigned_to: Int32?,
|
||||
color: String?
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue