todo-webclient/client/column-edit-modal.ls

49 lines
730 B
Plaintext

{h} = require "maquette"
{field, control, input, label} = require "./bulma.ls"
Modal = require "./modal.ls"
Column = require './column.ls'
deep-copy = (object) ->
JSON.parse JSON.stringify object
ColumnEditModal = (project, column, args) ->
self = {
column: if column
deep-copy column
else
Column ""
on-validation: args.on-validation || (column) ->
}
modal = Modal {
+visible
content: [
field [
label "Column title"
control [
input {
value: self.column.title
oninput: (e) ->
self.column.title = e.target.value
}
]
]
]
on-validation: ->
self.on-validation self.column
}
self.render = ->
modal.render!
self
module.exports = ColumnEditModal