modal
This commit is contained in:
parent
65084c3247
commit
9b6179eccf
11
Makefile
11
Makefile
@ -37,7 +37,7 @@ main.js: main.bundle.js
|
||||
$(Q)npx babel --minified main.bundle.js -o main.js
|
||||
|
||||
|
||||
main.bundle.js: client/index.ls client/authd.ls client/bulma.ls client/modal.ls client/project.ls client/task.ls client/todowebsocket.ls
|
||||
main.bundle.js: client/index.ls client/authd.ls client/bulma.ls client/modal.ls client/project.ls client/task.ls client/todowebsocket.ls client/validation-modal.ls
|
||||
@echo '[01;32m BUN > [01;37mmain.bundle.js[00m'
|
||||
$(Q)npx browserify -t browserify-livescript client/index.ls -o main.bundle.js
|
||||
|
||||
@ -121,7 +121,8 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls
|
||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/validation-modal.ls
|
||||
|
||||
dist-xz: $(PACKAGE)-$(VERSION).tar.xz
|
||||
$(PACKAGE)-$(VERSION).tar.xz: distdir
|
||||
@ -135,7 +136,8 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls
|
||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/validation-modal.ls
|
||||
|
||||
dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
|
||||
$(PACKAGE)-$(VERSION).tar.bz2: distdir
|
||||
@ -149,7 +151,8 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls
|
||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||
$(PACKAGE)-$(VERSION)/client/validation-modal.ls
|
||||
|
||||
help:
|
||||
@echo '[01;37m :: todo-webclient-0.1[00m'
|
||||
|
@ -33,14 +33,15 @@
|
||||
#
|
||||
# page 3: (TODO) pages about
|
||||
|
||||
maquette = require "maquette"
|
||||
nmd = require "nano-markdown"
|
||||
authd = require "./authd.ls"
|
||||
todows = require "./todowebsocket.ls"
|
||||
bulma = require "./bulma.ls"
|
||||
Task = require "./task.ls"
|
||||
Project = require "./project.ls"
|
||||
Modal = require "./modal.ls"
|
||||
maquette = require "maquette"
|
||||
nmd = require "nano-markdown"
|
||||
authd = require "./authd.ls"
|
||||
todows = require "./todowebsocket.ls"
|
||||
bulma = require "./bulma.ls"
|
||||
Task = require "./task.ls"
|
||||
Project = require "./project.ls"
|
||||
Modal = require "./modal.ls"
|
||||
# ValidationModal = require "./validation-modal.ls"
|
||||
|
||||
{create-projector, h} = maquette
|
||||
projector = create-projector!
|
||||
@ -48,22 +49,15 @@ projector = create-projector!
|
||||
model = {
|
||||
# view: login, todo-list, todo, network-error (TODO: other views, such as rights)
|
||||
# XXX FIXME TODO: TESTING THINGS
|
||||
# current-view: "login"
|
||||
current-view: "testing-modals"
|
||||
current-view: "login"
|
||||
|
||||
# TODO: currently-editing
|
||||
editing: undefined
|
||||
# TODO: currently-selected
|
||||
selected: undefined
|
||||
viewed-project: void
|
||||
|
||||
current-modal: true
|
||||
# current-view: "testing-modals"
|
||||
|
||||
# { uid => user data }
|
||||
users: {}
|
||||
|
||||
# list of todos-list
|
||||
projects: {}
|
||||
|
||||
todo-list: []
|
||||
|
||||
port: 9999
|
||||
@ -80,9 +74,6 @@ model = {
|
||||
jwt: undefined
|
||||
}
|
||||
|
||||
# TODO XXX FIXME
|
||||
model.modal = Modal {+visible}
|
||||
|
||||
model.authd-url =
|
||||
(if location.protocol == 'https' then 'wss' else 'ws') +
|
||||
'://' + location.hostname + \: +
|
||||
@ -168,37 +159,42 @@ on-websocket-close = (event) ->
|
||||
|
||||
projector.schedule-render!
|
||||
|
||||
|
||||
# model.projects[message.project.id] = Project.new message.project, model
|
||||
|
||||
# record changes that need to happen on a network event
|
||||
model.todod-ws.user-on-socket-error ++= [ on-websocket-error ]
|
||||
model.todod-ws.user-on-socket-close ++= [ on-websocket-close ]
|
||||
|
||||
model.todod-ws.add-event-listener \lists-list, (message) ->
|
||||
console.log message
|
||||
model.todo-list := message.lists
|
||||
for list in model.todo-list
|
||||
model.projects[list.id] := Project.new list, model
|
||||
model.todo-list := message.lists.map (x) ->
|
||||
Project.new x, model
|
||||
|
||||
projector.schedule-render!
|
||||
|
||||
model.todod-ws.add-event-listener \new-list, (message) ->
|
||||
console.log message
|
||||
model.todo-list := model.todo-list ++ [ message.list ]
|
||||
model.projects[message.list.id] := Project.new message.list, model
|
||||
model.todo-list := model.todo-list ++ [ (Project.new message.list, model) ]
|
||||
projector.schedule-render!
|
||||
|
||||
model.todod-ws.add-event-listener \tasks, (message) ->
|
||||
console.log message
|
||||
model.projects[message.list].tasks := message.tasks
|
||||
model.todo-list.find((.id == message.list)).tasks := message.tasks
|
||||
projector.schedule-render!
|
||||
|
||||
model.todod-ws.add-event-listener \list-removed, (message) ->
|
||||
console.log message
|
||||
if model.current-view == "todo" && model.viewed-project == message.list
|
||||
model.current-view := "todo-list"
|
||||
model.viewed-project := void
|
||||
projector.schedule-render!
|
||||
|
||||
model.todo-list := model.todo-list.filter((.id != message.list))
|
||||
|
||||
render-navbar = ->
|
||||
h \div.navbar [
|
||||
h \div.navbar-start [
|
||||
h \a.navbar-item.is-size-2 {
|
||||
onclick: ->
|
||||
model.viewed-project := undefined
|
||||
model.viewed-project := void
|
||||
model.current-view := "todo-list"
|
||||
} [ "⌂" ]
|
||||
]
|
||||
@ -214,15 +210,16 @@ render-navbar = ->
|
||||
|
||||
render-todo-list = ->
|
||||
h \div.section model.todo-list.map (project) ->
|
||||
h \a.box {
|
||||
key: project.id
|
||||
onclick: ->
|
||||
model.current-view := "todo"
|
||||
model.viewed-project := project.id
|
||||
model.todod-ws.get-list model.jwt, project.id
|
||||
} [
|
||||
bulma.title 4 project.title
|
||||
]
|
||||
if project
|
||||
h \div.box {
|
||||
key: project.id
|
||||
onclick: ->
|
||||
model.current-view := "todo"
|
||||
model.viewed-project := project.id
|
||||
model.todod-ws.get-list model.jwt, project.id
|
||||
} [
|
||||
bulma.title 4 project.title
|
||||
]
|
||||
|
||||
render-new-project-button = ->
|
||||
h \div.button.is-primary.is-large.is-fullwidth {
|
||||
@ -233,8 +230,23 @@ render-new-project-button = ->
|
||||
} [ "New project!" ]
|
||||
|
||||
render-todo = (todo-id) ->
|
||||
if model.projects[todo-id]
|
||||
model.projects[todo-id].render!
|
||||
todo = model.todo-list.find((.id == todo-id))
|
||||
if todo
|
||||
todo.render!
|
||||
h \div.button.is-danger.is-outlined {
|
||||
onclick: ->
|
||||
console.log "La modal est crée"
|
||||
model.modal := Modal {
|
||||
+visible
|
||||
content:
|
||||
h \p [ "Are you sure you want to remove board #{todo.title}?" ]
|
||||
on-validation: ->
|
||||
model.todod-ws.remove-list model.jwt, todo.id
|
||||
}
|
||||
console.log "La modal est crée 2 le retour", model.modal
|
||||
|
||||
projector.schedule-render!
|
||||
} [ "X" ]
|
||||
else
|
||||
h \div.notification.is-error [
|
||||
bulma.title 3 "Error, we did not get the todo id " + todo-id
|
||||
@ -287,6 +299,9 @@ render-body = ->
|
||||
h \div.notification.is-error [
|
||||
"Wait, what? Internal error!"
|
||||
]
|
||||
|
||||
if model.modal
|
||||
model.modal.render!
|
||||
]
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
|
||||
self.render-column = (column) ->
|
||||
console.log "render column: ", column
|
||||
bulma.modal {} [(h \div {} [ "rendering " + column ])]
|
||||
# bulma.modal {} [(h \div {} [ "rendering " + column ])]
|
||||
|
||||
# h \div.column.is-3 {
|
||||
# key: column
|
||||
|
Loading…
Reference in New Issue
Block a user