todo-webclient/client/task.ls

52 lines
798 B
Plaintext

#
# Tasks, previous version of todos
#
h = require 'maquette' .h
bulma = require "./bulma.ls"
nmd = require "nano-markdown"
TaskCreationModal = require './TaskCreationModal.ls'
#
# generic functions
#
get-previous = (collection, element) ->
var previous
for item in collection
if item == element
return previous
previous = item
get-next = (collection, element) ->
var found-element
for item in collection
if found-element
return item
if item == element
found-element := true
Task = (self, project, todod-ws) ->
modal = void
self.render = ->
h \div { key: self.id } [
self.title
h \div.button {
onclick: ->
modal := TaskCreationModal project.id, todod-ws, self
} [ "Edit" ]
if modal
modal.render!
]
self
module.exports = Task