todo-webclient/client/task.ls

68 lines
1.1 KiB
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 04:10:00 +01:00
TaskCreationModal = require './task-creation-modal.ls'
2019-12-06 04:07:19 +01:00
TaskRemovalModal = require './task-removal-modal.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 = ->
2019-12-06 04:07:19 +01:00
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: ->
2019-12-06 05:04:55 +01:00
modal := TaskCreationModal project, todod-ws, self
2019-12-06 04:07:19 +01:00
} [ "Edit" ]
h \div.button {
onclick: ->
modal := TaskRemovalModal project.id, todod-ws, self
} [ "X" ]
]
h \div.content [
self.description
]
]
2019-12-06 01:56:32 +01:00
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