todo-webclient/client/task.ls

52 lines
798 B
Plaintext
Raw Normal View History

2019-11-22 16:52:50 +01:00
#
# Tasks, previous version of todos
#
h = require 'maquette' .h
bulma = require "./bulma.ls"
nmd = require "nano-markdown"
2019-12-06 01:56:32 +01:00
TaskCreationModal = require './TaskCreationModal.ls'
2019-11-22 16:52:50 +01:00
#
# 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
2019-12-06 01:56:32 +01:00
Task = (self, project, todod-ws) ->
modal = void
2019-12-06 01:56:32 +01:00
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!
]
2019-12-05 02:28:17 +01:00
self
2019-11-22 16:52:50 +01:00
2019-12-05 02:28:17 +01:00
module.exports = Task