69 lines
1.6 KiB
Plaintext
69 lines
1.6 KiB
Plaintext
{h} = require "maquette"
|
|
|
|
{button, field, control} = require "./bulma.ls"
|
|
|
|
render-new-project-button = (model) ->
|
|
h \div.button.is-success.is-medium.is-outlined {
|
|
onclick: ->
|
|
model.todod-ws.add-list "New project", {
|
|
extra_properties: {
|
|
columns: [
|
|
Column "Unassigned"
|
|
Column "Work in progress"
|
|
Column "To be checked"
|
|
Column "Being checked"
|
|
Column "Done"
|
|
]
|
|
}
|
|
}
|
|
} [ "New project!" ]
|
|
|
|
|
|
Navbar = ->
|
|
self = {}
|
|
|
|
self.render = (model) ->
|
|
h \div.navbar [
|
|
h \div.navbar-start [
|
|
h \div.navbar-brand [
|
|
h \a.navbar-item {
|
|
onclick: ->
|
|
if model.viewed-project
|
|
model.todod-ws.unsubscribe model.viewed-project.id
|
|
model.todod-ws.list-lists!
|
|
model.viewed-project := void
|
|
model.current-view := "project-list"
|
|
} [
|
|
"todod - kanbanc"
|
|
]
|
|
]
|
|
]
|
|
|
|
if model.current-view == "project" && model.viewed-project
|
|
model.viewed-project.inner-nav-render!
|
|
|
|
if model.current-view != "login"
|
|
h \div.navbar-end [
|
|
if model.current-view == "project-list"
|
|
h \div.navbar-item {key: "new project"} [
|
|
render-new-project-button model
|
|
]
|
|
else if model.current-view == "project" && model.viewed-project
|
|
model.viewed-project.right-nav-render!
|
|
|
|
h \div.navbar-item {key: "logout"} [
|
|
h \a.button.is-medium.is-outlined {
|
|
onclick: ->
|
|
model.current-view := "login"
|
|
# TODO: remove anything related to the old session on the client
|
|
model.todod-ws.reopen!
|
|
} [ "Logout" ]
|
|
]
|
|
]
|
|
]
|
|
|
|
self
|
|
|
|
module.exports = Navbar
|
|
|