66 lines
1.2 KiB
Plaintext
66 lines
1.2 KiB
Plaintext
|
|
h = require 'maquette' .h
|
|
Modal = require './modal.ls'
|
|
|
|
TaskCreationModal = (project, todod-ws, task) ->
|
|
task ||= {}
|
|
|
|
self = {
|
|
title: task.title || ""
|
|
description: task.description || ""
|
|
columns: []
|
|
column: void
|
|
}
|
|
|
|
modal = Modal {
|
|
+visible
|
|
content: h \div.form [
|
|
h \input.input {
|
|
value: self.title
|
|
oninput: (e) ->
|
|
self.title := e.target.value
|
|
}
|
|
|
|
h \textarea {
|
|
value: self.description
|
|
oninput: (e) ->
|
|
self.description := e.target.value
|
|
}
|
|
|
|
h \div.menu [
|
|
h \p.menu-label [ "Choose the column" ]
|
|
h \ul.menu-list project.extra_properties.columns.map (column) ->
|
|
h \li [
|
|
h \a {
|
|
onclick: ->
|
|
self.column := column.id
|
|
} [ column.title ]
|
|
]
|
|
|
|
]
|
|
]
|
|
on-validation: ->
|
|
if task.id
|
|
todod-ws.edit-task task.id, {
|
|
title: self.title
|
|
description: self.description
|
|
extra_properties: {
|
|
column: self.column || ""
|
|
}
|
|
}
|
|
else
|
|
todod-ws.add-task project.id, self.title, {
|
|
description: self.description
|
|
extra_properties: {
|
|
column: self.column || ""
|
|
}
|
|
}
|
|
}
|
|
|
|
self.render = ->
|
|
modal.render!
|
|
|
|
self
|
|
|
|
module.exports = TaskCreationModal
|