Logout, navbar.

master
Luka Vandervelden 2019-07-10 13:13:52 +02:00
parent f70f8a17f3
commit 0e86ca5806
1 changed files with 27 additions and 10 deletions

View File

@ -376,6 +376,10 @@ KanbanSocket = (socket-url) ->
self.socket.onmessage = (event) ->
self.on-message event
self.reopen = ->
self.socket.close!
self.open-socket!
self.open-socket!
self.send = (opts) ->
@ -502,6 +506,25 @@ socket.on-message = (event) ->
console.log message
renderer = ->
render-navbar = ->
h \div.navbar [
h \div.navbar-start [
h \a.navbar-item.is-size-1 {
onclick: ->
model.viewed-project := undefined
model.current-view := "projects-list"
} [ "⌂" ]
]
h \div.navbar-end [
h \a.navbar-item {
onclick: ->
model.current-view := "login"
socket.reopen!
} [ "Logout" ]
]
]
h \div.section [
switch model.current-view
when "login"
@ -539,22 +562,16 @@ renderer = ->
]
when "project"
h \div [
h \div.navbar [
h \div.navbar-end [
h \a.navbar-item {
onclick: ->
model.viewed-project := undefined
model.current-view := "projects-list"
} [ "Go back" ]
]
]
render-navbar!
if model.projects[model.viewed-project]
model.projects[model.viewed-project].render!
]
when "projects-list"
h \div#projects-list [
h \div (model.projects-list || []).map (project) ->
render-navbar!
h \div.section (model.projects-list || []).map (project) ->
h \a.box {
key: project.id
onclick: ->