.extra_properties.assignee-id => .assigned_to
This commit is contained in:
parent
f096fcec4f
commit
d4d21dd3fa
@ -6,6 +6,9 @@ Modal = require './modal.ls'
|
|||||||
|
|
||||||
{field, input, textarea, label, control, select} = require './bulma.ls'
|
{field, input, textarea, label, control, select} = require './bulma.ls'
|
||||||
|
|
||||||
|
# FIXME: This be a copy-pasta. Somebody gotta touch this spaghetti.
|
||||||
|
const PERMISSION_LEVELS = ["admin", "edit", "read"]
|
||||||
|
|
||||||
colors = [
|
colors = [
|
||||||
"white"
|
"white"
|
||||||
"black"
|
"black"
|
||||||
@ -40,10 +43,11 @@ color-to-form-selection = (self, color, current-color) ->
|
|||||||
selected: current-color && current-color == color
|
selected: current-color && current-color == color
|
||||||
} [ color ]
|
} [ color ]
|
||||||
|
|
||||||
user-form-selection = (self, user) ->
|
user-form-selection = (self, uid, is-selected) ->
|
||||||
h \option {
|
h \option {
|
||||||
value: user.uid
|
selected: is-selected
|
||||||
} [ user.login ]
|
value: uid.to-string!
|
||||||
|
} [ uid.to-string! ]
|
||||||
|
|
||||||
TaskCreationModal = (project, todod-ws, task, users) ->
|
TaskCreationModal = (project, todod-ws, task, users) ->
|
||||||
task ||= {}
|
task ||= {}
|
||||||
@ -52,12 +56,10 @@ TaskCreationModal = (project, todod-ws, task, users) ->
|
|||||||
self = {
|
self = {
|
||||||
title: task.title || ""
|
title: task.title || ""
|
||||||
description: task.description || ""
|
description: task.description || ""
|
||||||
|
assigned_to: task.assigned_to
|
||||||
extra_properties:
|
extra_properties:
|
||||||
column: ""
|
column: ""
|
||||||
background-color: ""
|
background-color: ""
|
||||||
assignee-id: task.assignee-id || void
|
|
||||||
tmp:
|
|
||||||
users: users || []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# copy extra properties
|
# copy extra properties
|
||||||
@ -126,11 +128,22 @@ TaskCreationModal = (project, todod-ws, task, users) ->
|
|||||||
} [
|
} [
|
||||||
select \.is-fullwidth {
|
select \.is-fullwidth {
|
||||||
onchange: (e) ->
|
onchange: (e) ->
|
||||||
self.extra_properties.assignee-id := e.target.value
|
if uid = parse-int e.target.value
|
||||||
|
self.assigned_to := uid
|
||||||
|
else
|
||||||
|
self.assigned_to := void
|
||||||
} [
|
} [
|
||||||
user-form-selection self, { login: "Choose a user", uid: "-" }
|
h \option {
|
||||||
for user-id, user of self.tmp.users
|
default: true
|
||||||
user-form-selection self, user
|
value: ""
|
||||||
|
} [ "(unassigned)" ]
|
||||||
|
|
||||||
|
for permission in PERMISSION_LEVELS
|
||||||
|
[
|
||||||
|
for uid in project.permissions[permission]
|
||||||
|
user-form-selection self, uid,
|
||||||
|
(self.assigned_to == uid)
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -6,16 +6,12 @@ TaskRemovalModal = require './task-removal-modal.ls'
|
|||||||
|
|
||||||
{icon} = require "./font-awesome.ls"
|
{icon} = require "./font-awesome.ls"
|
||||||
|
|
||||||
display-login = (task, users) ->
|
|
||||||
if task.extra_properties && task.extra_properties.assignee-id && users && users[task.extra_properties.assignee-id] && users[task.extra_properties.assignee-id].login
|
|
||||||
h \p [ '@' + users[task.extra_properties.assignee-id].login ]
|
|
||||||
else
|
|
||||||
h \p [ '-' ]
|
|
||||||
|
|
||||||
|
|
||||||
Task = (self, project, todod-ws) ->
|
Task = (self, project, todod-ws) ->
|
||||||
modal = void
|
modal = void
|
||||||
|
|
||||||
|
self.render-login = (uid) ->
|
||||||
|
h \p [ '@' + uid.to-string! ]
|
||||||
|
|
||||||
self.render = (args) ->
|
self.render = (args) ->
|
||||||
args or= {}
|
args or= {}
|
||||||
|
|
||||||
@ -47,7 +43,8 @@ Task = (self, project, todod-ws) ->
|
|||||||
# FIXME: assignee card image
|
# FIXME: assignee card image
|
||||||
]
|
]
|
||||||
h \div.media-content [
|
h \div.media-content [
|
||||||
display-login self, project.users
|
if uid = self.assigned_to
|
||||||
|
self.render-login uid
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user