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
|
$(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'
|
@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,8 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
|||||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task.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
|
dist-xz: $(PACKAGE)-$(VERSION).tar.xz
|
||||||
$(PACKAGE)-$(VERSION).tar.xz: distdir
|
$(PACKAGE)-$(VERSION).tar.xz: distdir
|
||||||
@ -135,7 +136,8 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
|||||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task.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
|
dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
|
||||||
$(PACKAGE)-$(VERSION).tar.bz2: distdir
|
$(PACKAGE)-$(VERSION).tar.bz2: distdir
|
||||||
@ -149,7 +151,8 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
|||||||
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
$(PACKAGE)-$(VERSION)/client/modal.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/project.ls \
|
$(PACKAGE)-$(VERSION)/client/project.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/task.ls \
|
$(PACKAGE)-$(VERSION)/client/task.ls \
|
||||||
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls
|
$(PACKAGE)-$(VERSION)/client/todowebsocket.ls \
|
||||||
|
$(PACKAGE)-$(VERSION)/client/validation-modal.ls
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo '[01;37m :: todo-webclient-0.1[00m'
|
@echo '[01;37m :: todo-webclient-0.1[00m'
|
||||||
|
@ -41,6 +41,7 @@ bulma = require "./bulma.ls"
|
|||||||
Task = require "./task.ls"
|
Task = require "./task.ls"
|
||||||
Project = require "./project.ls"
|
Project = require "./project.ls"
|
||||||
Modal = require "./modal.ls"
|
Modal = require "./modal.ls"
|
||||||
|
# ValidationModal = require "./validation-modal.ls"
|
||||||
|
|
||||||
{create-projector, h} = maquette
|
{create-projector, h} = maquette
|
||||||
projector = create-projector!
|
projector = create-projector!
|
||||||
@ -48,22 +49,15 @@ projector = create-projector!
|
|||||||
model = {
|
model = {
|
||||||
# view: login, todo-list, todo, network-error (TODO: other views, such as rights)
|
# view: login, todo-list, todo, network-error (TODO: other views, such as rights)
|
||||||
# XXX FIXME TODO: TESTING THINGS
|
# XXX FIXME TODO: TESTING THINGS
|
||||||
# current-view: "login"
|
current-view: "login"
|
||||||
current-view: "testing-modals"
|
|
||||||
|
|
||||||
# TODO: currently-editing
|
viewed-project: void
|
||||||
editing: undefined
|
|
||||||
# TODO: currently-selected
|
|
||||||
selected: undefined
|
|
||||||
|
|
||||||
current-modal: true
|
# current-view: "testing-modals"
|
||||||
|
|
||||||
# { uid => user data }
|
# { uid => user data }
|
||||||
users: {}
|
users: {}
|
||||||
|
|
||||||
# list of todos-list
|
|
||||||
projects: {}
|
|
||||||
|
|
||||||
todo-list: []
|
todo-list: []
|
||||||
|
|
||||||
port: 9999
|
port: 9999
|
||||||
@ -80,9 +74,6 @@ model = {
|
|||||||
jwt: undefined
|
jwt: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO XXX FIXME
|
|
||||||
model.modal = Modal {+visible}
|
|
||||||
|
|
||||||
model.authd-url =
|
model.authd-url =
|
||||||
(if location.protocol == 'https' then 'wss' else 'ws') +
|
(if location.protocol == 'https' then 'wss' else 'ws') +
|
||||||
'://' + location.hostname + \: +
|
'://' + location.hostname + \: +
|
||||||
@ -168,37 +159,42 @@ on-websocket-close = (event) ->
|
|||||||
|
|
||||||
projector.schedule-render!
|
projector.schedule-render!
|
||||||
|
|
||||||
|
|
||||||
# model.projects[message.project.id] = Project.new message.project, model
|
|
||||||
|
|
||||||
# record changes that need to happen on a network event
|
# 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-error ++= [ on-websocket-error ]
|
||||||
model.todod-ws.user-on-socket-close ++= [ on-websocket-close ]
|
model.todod-ws.user-on-socket-close ++= [ on-websocket-close ]
|
||||||
|
|
||||||
model.todod-ws.add-event-listener \lists-list, (message) ->
|
model.todod-ws.add-event-listener \lists-list, (message) ->
|
||||||
console.log message
|
console.log message
|
||||||
model.todo-list := message.lists
|
model.todo-list := message.lists.map (x) ->
|
||||||
for list in model.todo-list
|
Project.new x, model
|
||||||
model.projects[list.id] := Project.new list, model
|
|
||||||
projector.schedule-render!
|
projector.schedule-render!
|
||||||
|
|
||||||
model.todod-ws.add-event-listener \new-list, (message) ->
|
model.todod-ws.add-event-listener \new-list, (message) ->
|
||||||
console.log message
|
console.log message
|
||||||
model.todo-list := model.todo-list ++ [ message.list ]
|
model.todo-list := model.todo-list ++ [ (Project.new message.list, model) ]
|
||||||
model.projects[message.list.id] := Project.new message.list, model
|
|
||||||
projector.schedule-render!
|
projector.schedule-render!
|
||||||
|
|
||||||
model.todod-ws.add-event-listener \tasks, (message) ->
|
model.todod-ws.add-event-listener \tasks, (message) ->
|
||||||
console.log message
|
console.log message
|
||||||
model.projects[message.list].tasks := message.tasks
|
model.todo-list.find((.id == message.list)).tasks := message.tasks
|
||||||
projector.schedule-render!
|
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 = ->
|
render-navbar = ->
|
||||||
h \div.navbar [
|
h \div.navbar [
|
||||||
h \div.navbar-start [
|
h \div.navbar-start [
|
||||||
h \a.navbar-item.is-size-2 {
|
h \a.navbar-item.is-size-2 {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
model.viewed-project := undefined
|
model.viewed-project := void
|
||||||
model.current-view := "todo-list"
|
model.current-view := "todo-list"
|
||||||
} [ "⌂" ]
|
} [ "⌂" ]
|
||||||
]
|
]
|
||||||
@ -214,7 +210,8 @@ render-navbar = ->
|
|||||||
|
|
||||||
render-todo-list = ->
|
render-todo-list = ->
|
||||||
h \div.section model.todo-list.map (project) ->
|
h \div.section model.todo-list.map (project) ->
|
||||||
h \a.box {
|
if project
|
||||||
|
h \div.box {
|
||||||
key: project.id
|
key: project.id
|
||||||
onclick: ->
|
onclick: ->
|
||||||
model.current-view := "todo"
|
model.current-view := "todo"
|
||||||
@ -233,8 +230,23 @@ render-new-project-button = ->
|
|||||||
} [ "New project!" ]
|
} [ "New project!" ]
|
||||||
|
|
||||||
render-todo = (todo-id) ->
|
render-todo = (todo-id) ->
|
||||||
if model.projects[todo-id]
|
todo = model.todo-list.find((.id == todo-id))
|
||||||
model.projects[todo-id].render!
|
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
|
else
|
||||||
h \div.notification.is-error [
|
h \div.notification.is-error [
|
||||||
bulma.title 3 "Error, we did not get the todo id " + todo-id
|
bulma.title 3 "Error, we did not get the todo id " + todo-id
|
||||||
@ -287,6 +299,9 @@ render-body = ->
|
|||||||
h \div.notification.is-error [
|
h \div.notification.is-error [
|
||||||
"Wait, what? Internal error!"
|
"Wait, what? Internal error!"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if model.modal
|
||||||
|
model.modal.render!
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ module.exports = {
|
|||||||
|
|
||||||
self.render-column = (column) ->
|
self.render-column = (column) ->
|
||||||
console.log "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 {
|
# h \div.column.is-3 {
|
||||||
# key: column
|
# key: column
|
||||||
|
Loading…
Reference in New Issue
Block a user