adding, editing, removing tasks: done

dev
Philippe PITTOLI 2019-12-06 05:04:55 +01:00
parent 0e7fdb9ecf
commit 2e86433d25
3 changed files with 33 additions and 7 deletions

View File

@ -17,9 +17,15 @@ Project = (self, todod-ws) ->
|| ((! task.extra_properties || ! task.extra_properties.column) && first)
h \div.column [
bulma.title 4 column.title
for task in tasks-to-display
task.render!
h \div.card { key: self.id } [
h \div.cart-head [
h \p.title.is-4 [ column.title ]
]
h \div.card-content { key: self.id } [
for task in tasks-to-display
task.render!
]
]
]
self.render = ->
@ -39,7 +45,7 @@ Project = (self, todod-ws) ->
h \div.navbar-item [
h \div.button.is-success.is-outlined {
onclick: ->
modal := TaskCreationModal self.id, self.todod-ws
modal := TaskCreationModal self, self.todod-ws
} [ "+" ]
]

View File

@ -2,12 +2,14 @@
h = require 'maquette' .h
Modal = require './modal.ls'
TaskCreationModal = (project-id, todod-ws, task) ->
TaskCreationModal = (project, todod-ws, task) ->
task ||= {}
self = {
title: task.title || ""
description: task.description || ""
columns: []
column: void
}
modal = Modal {
@ -24,16 +26,34 @@ TaskCreationModal = (project-id, todod-ws, task) ->
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, {
todod-ws.add-task project.id, self.title, {
description: self.description
extra_properties: {
column: self.column || ""
}
}
}

View File

@ -47,7 +47,7 @@ Task = (self, project, todod-ws) ->
]
h \div.button {
onclick: ->
modal := TaskCreationModal project.id, todod-ws, self
modal := TaskCreationModal project, todod-ws, self
} [ "Edit" ]
h \div.button {
onclick: ->