task modals
This commit is contained in:
parent
23abce6d6c
commit
0e7fdb9ecf
8
Makefile
8
Makefile
@ -37,7 +37,7 @@ main.js: main.bundle.js
|
|||||||
$(Q)npx babel --minified main.bundle.js -o main.js
|
$(Q)npx babel --minified main.bundle.js -o main.js
|
||||||
|
|
||||||
|
|
||||||
main.bundle.js: client/index.ls client/authd.ls client/bulma.ls client/card.ls client/modal.ls client/project.ls client/TaskCreationModal.ls client/task.ls client/task-removal-modal.ls client/todowebsocket.ls client/validation-modal.ls
|
main.bundle.js: client/index.ls client/authd.ls client/bulma.ls client/card.ls client/modal.ls client/project.ls client/task-creation-modal.ls client/task.ls client/task-removal-modal.ls client/todowebsocket.ls client/validation-modal.ls
|
||||||
@echo '[01;32m BUN > [01;37mmain.bundle.js[00m'
|
@echo '[01;32m BUN > [01;37mmain.bundle.js[00m'
|
||||||
$(Q)npx browserify -t browserify-livescript client/index.ls -o main.bundle.js
|
$(Q)npx browserify -t browserify-livescript client/index.ls -o main.bundle.js
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
|||||||
$(PACKAGE)-$(VERSION)/client/card.ls \
|
$(PACKAGE)-$(VERSION)/client/card.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/TaskCreationModal.ls \
|
$(PACKAGE)-$(VERSION)/client/task-creation-modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task-removal-modal.ls \
|
$(PACKAGE)-$(VERSION)/client/task-removal-modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||||
@ -139,7 +139,7 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
|||||||
$(PACKAGE)-$(VERSION)/client/card.ls \
|
$(PACKAGE)-$(VERSION)/client/card.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/TaskCreationModal.ls \
|
$(PACKAGE)-$(VERSION)/client/task-creation-modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task-removal-modal.ls \
|
$(PACKAGE)-$(VERSION)/client/task-removal-modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||||
@ -157,7 +157,7 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
|||||||
$(PACKAGE)-$(VERSION)/client/card.ls \
|
$(PACKAGE)-$(VERSION)/client/card.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/TaskCreationModal.ls \
|
$(PACKAGE)-$(VERSION)/client/task-creation-modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task-removal-modal.ls \
|
$(PACKAGE)-$(VERSION)/client/task-removal-modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||||
|
41
client/card.ls
Normal file
41
client/card.ls
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
h = require 'maquette' .h
|
||||||
|
|
||||||
|
TaskCard = (key, head-left, head-content, content, on-click) ->
|
||||||
|
self = {
|
||||||
|
key: key
|
||||||
|
head-left: head-left
|
||||||
|
head-content: head-content
|
||||||
|
content: content
|
||||||
|
modal: void
|
||||||
|
}
|
||||||
|
|
||||||
|
self.render = ->
|
||||||
|
h \div.card { key: self.key } [
|
||||||
|
h \div.card-content [
|
||||||
|
h \div.media [
|
||||||
|
h \div.media-left [
|
||||||
|
self.head-left
|
||||||
|
]
|
||||||
|
h \div.media-content [
|
||||||
|
self.head-content
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
h \div.content [
|
||||||
|
self.title
|
||||||
|
h \div.button {
|
||||||
|
onclick: -> on-click!
|
||||||
|
modal := TaskCreationModal project.id, todod-ws, self
|
||||||
|
} [ "Edit" ]
|
||||||
|
|
||||||
|
if self.modal
|
||||||
|
self.modal.render!
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
self
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = Card
|
@ -3,7 +3,7 @@ h = require 'maquette' .h
|
|||||||
bulma = require "./bulma.ls"
|
bulma = require "./bulma.ls"
|
||||||
Task = require "./task.ls"
|
Task = require "./task.ls"
|
||||||
Modal = require './modal.ls'
|
Modal = require './modal.ls'
|
||||||
TaskCreationModal = require './TaskCreationModal.ls'
|
TaskCreationModal = require './task-creation-modal.ls'
|
||||||
|
|
||||||
Project = (self, todod-ws) ->
|
Project = (self, todod-ws) ->
|
||||||
self.todod-ws = todod-ws
|
self.todod-ws = todod-ws
|
||||||
|
45
client/task-creation-modal.ls
Normal file
45
client/task-creation-modal.ls
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
h = require 'maquette' .h
|
||||||
|
Modal = require './modal.ls'
|
||||||
|
|
||||||
|
TaskCreationModal = (project-id, todod-ws, task) ->
|
||||||
|
task ||= {}
|
||||||
|
|
||||||
|
self = {
|
||||||
|
title: task.title || ""
|
||||||
|
description: task.description || ""
|
||||||
|
}
|
||||||
|
|
||||||
|
modal = Modal {
|
||||||
|
+visible
|
||||||
|
content: h \div.form [
|
||||||
|
h \input.input {
|
||||||
|
value: self.title
|
||||||
|
oninput: (e) ->
|
||||||
|
self.title := e.target.value
|
||||||
|
}
|
||||||
|
|
||||||
|
h \textarea {
|
||||||
|
value: self.description
|
||||||
|
oninput: (e) ->
|
||||||
|
self.description := e.target.value
|
||||||
|
}
|
||||||
|
]
|
||||||
|
on-validation: ->
|
||||||
|
if task.id
|
||||||
|
todod-ws.edit-task task.id, {
|
||||||
|
title: self.title
|
||||||
|
description: self.description
|
||||||
|
}
|
||||||
|
else
|
||||||
|
todod-ws.add-task project-id, self.title, {
|
||||||
|
description: self.description
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.render = ->
|
||||||
|
modal.render!
|
||||||
|
|
||||||
|
self
|
||||||
|
|
||||||
|
module.exports = TaskCreationModal
|
28
client/task-removal-modal.ls
Normal file
28
client/task-removal-modal.ls
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
h = require 'maquette' .h
|
||||||
|
Modal = require './modal.ls'
|
||||||
|
|
||||||
|
TaskRemovalModal = (project-id, todod-ws, task) ->
|
||||||
|
task ||= {}
|
||||||
|
|
||||||
|
self = {
|
||||||
|
title: task.title || ""
|
||||||
|
description: task.description || ""
|
||||||
|
}
|
||||||
|
|
||||||
|
modal = Modal {
|
||||||
|
+visible
|
||||||
|
content: h \div.is-danger [ "Do you want to remove the task ?" ]
|
||||||
|
|
||||||
|
on-validation: ->
|
||||||
|
if task.id
|
||||||
|
todod-ws.remove-task task.id
|
||||||
|
}
|
||||||
|
|
||||||
|
self.render = ->
|
||||||
|
modal.render!
|
||||||
|
|
||||||
|
self
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = TaskRemovalModal
|
@ -5,7 +5,7 @@
|
|||||||
h = require 'maquette' .h
|
h = require 'maquette' .h
|
||||||
bulma = require "./bulma.ls"
|
bulma = require "./bulma.ls"
|
||||||
nmd = require "nano-markdown"
|
nmd = require "nano-markdown"
|
||||||
TaskCreationModal = require './TaskCreationModal.ls'
|
TaskCreationModal = require './task-creation-modal.ls'
|
||||||
TaskRemovalModal = require './task-removal-modal.ls'
|
TaskRemovalModal = require './task-removal-modal.ls'
|
||||||
|
|
||||||
#
|
#
|
||||||
|
16
client/validation-modal.ls
Normal file
16
client/validation-modal.ls
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
h = require 'maquette' .h
|
||||||
|
Modal = require './modal.ls'
|
||||||
|
|
||||||
|
|
||||||
|
# ValidationModal = (args) ->
|
||||||
|
# m = Modal (args)
|
||||||
|
# m.result = void
|
||||||
|
# m.on-validation = ->
|
||||||
|
# m.result = true
|
||||||
|
# m.on-cancellation = ->
|
||||||
|
# m.result = false
|
||||||
|
# m
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = ValidationModal
|
Loading…
Reference in New Issue
Block a user