todo-webclient/client/task.ls

68 lines
1.1 KiB
Plaintext

#
# Tasks, previous version of todos
#
h = require 'maquette' .h
bulma = require "./bulma.ls"
nmd = require "nano-markdown"
TaskCreationModal = require './TaskCreationModal.ls'
TaskRemovalModal = require './task-removal-modal.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.card { key: self.id } [
h \div.card-content [
h \div.media [
h \div.media-left [
"LEFT"
]
h \div.media-content [
self.title
]
h \div.button {
onclick: ->
modal := TaskCreationModal project.id, todod-ws, self
} [ "Edit" ]
h \div.button {
onclick: ->
modal := TaskRemovalModal project.id, todod-ws, self
} [ "X" ]
]
h \div.content [
self.description
]
]
if modal
modal.render!
]
self
module.exports = Task