adding, editing, removing tasks: done
This commit is contained in:
parent
0e7fdb9ecf
commit
2e86433d25
@ -17,9 +17,15 @@ Project = (self, todod-ws) ->
|
|||||||
|| ((! task.extra_properties || ! task.extra_properties.column) && first)
|
|| ((! task.extra_properties || ! task.extra_properties.column) && first)
|
||||||
|
|
||||||
h \div.column [
|
h \div.column [
|
||||||
bulma.title 4 column.title
|
h \div.card { key: self.id } [
|
||||||
for task in tasks-to-display
|
h \div.cart-head [
|
||||||
task.render!
|
h \p.title.is-4 [ column.title ]
|
||||||
|
]
|
||||||
|
h \div.card-content { key: self.id } [
|
||||||
|
for task in tasks-to-display
|
||||||
|
task.render!
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
self.render = ->
|
self.render = ->
|
||||||
@ -39,7 +45,7 @@ Project = (self, todod-ws) ->
|
|||||||
h \div.navbar-item [
|
h \div.navbar-item [
|
||||||
h \div.button.is-success.is-outlined {
|
h \div.button.is-success.is-outlined {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
modal := TaskCreationModal self.id, self.todod-ws
|
modal := TaskCreationModal self, self.todod-ws
|
||||||
} [ "+" ]
|
} [ "+" ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
h = require 'maquette' .h
|
h = require 'maquette' .h
|
||||||
Modal = require './modal.ls'
|
Modal = require './modal.ls'
|
||||||
|
|
||||||
TaskCreationModal = (project-id, todod-ws, task) ->
|
TaskCreationModal = (project, todod-ws, task) ->
|
||||||
task ||= {}
|
task ||= {}
|
||||||
|
|
||||||
self = {
|
self = {
|
||||||
title: task.title || ""
|
title: task.title || ""
|
||||||
description: task.description || ""
|
description: task.description || ""
|
||||||
|
columns: []
|
||||||
|
column: void
|
||||||
}
|
}
|
||||||
|
|
||||||
modal = Modal {
|
modal = Modal {
|
||||||
@ -24,16 +26,34 @@ TaskCreationModal = (project-id, todod-ws, task) ->
|
|||||||
oninput: (e) ->
|
oninput: (e) ->
|
||||||
self.description := e.target.value
|
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: ->
|
on-validation: ->
|
||||||
if task.id
|
if task.id
|
||||||
todod-ws.edit-task task.id, {
|
todod-ws.edit-task task.id, {
|
||||||
title: self.title
|
title: self.title
|
||||||
description: self.description
|
description: self.description
|
||||||
|
extra_properties: {
|
||||||
|
column: self.column || ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
todod-ws.add-task project-id, self.title, {
|
todod-ws.add-task project.id, self.title, {
|
||||||
description: self.description
|
description: self.description
|
||||||
|
extra_properties: {
|
||||||
|
column: self.column || ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ Task = (self, project, todod-ws) ->
|
|||||||
]
|
]
|
||||||
h \div.button {
|
h \div.button {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
modal := TaskCreationModal project.id, todod-ws, self
|
modal := TaskCreationModal project, todod-ws, self
|
||||||
} [ "Edit" ]
|
} [ "Edit" ]
|
||||||
h \div.button {
|
h \div.button {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
|
Loading…
Reference in New Issue
Block a user