Grooming.
This commit is contained in:
parent
6511607f3c
commit
79dcb48429
@ -20,12 +20,33 @@ module.exports = {
|
|||||||
h \input.input args, children
|
h \input.input args, children
|
||||||
textarea: (args, children) ->
|
textarea: (args, children) ->
|
||||||
h \textarea.textarea args, children
|
h \textarea.textarea args, children
|
||||||
control: (args, children) ->
|
control: (selector, args, children) ->
|
||||||
h \div.control args, children
|
if typeof(selector) == "object"
|
||||||
|
children = args
|
||||||
|
args = selector
|
||||||
|
selector = ""
|
||||||
|
|
||||||
|
h (\div.control + selector), args, children
|
||||||
|
button: (selector, args, children) ->
|
||||||
|
if typeof(selector) == "object"
|
||||||
|
children = args
|
||||||
|
args = selector
|
||||||
|
selector = ""
|
||||||
|
|
||||||
|
h (\div.button + selector), args, children
|
||||||
|
tag: (selector, args, children) ->
|
||||||
|
if typeof(selector) == "object"
|
||||||
|
children = args
|
||||||
|
args = selector
|
||||||
|
selector = ""
|
||||||
|
|
||||||
|
h (\div.tag + selector), args, children
|
||||||
|
|
||||||
select: (selector, args, children) ->
|
select: (selector, args, children) ->
|
||||||
if typeof(selector) == "object"
|
if typeof(selector) == "object"
|
||||||
children = args
|
children = args
|
||||||
args = selector
|
args = selector
|
||||||
|
selector = ""
|
||||||
|
|
||||||
h (\div.select + selector), {
|
h (\div.select + selector), {
|
||||||
} [
|
} [
|
||||||
@ -36,8 +57,13 @@ module.exports = {
|
|||||||
|
|
||||||
# FIXME: Use only args and add args.label and args.input?
|
# FIXME: Use only args and add args.label and args.input?
|
||||||
# Or maybe args.name and args.type could be used directly?
|
# Or maybe args.name and args.type could be used directly?
|
||||||
field: (args, children) ->
|
field: (selector, args, children) ->
|
||||||
h \div.field args, children
|
if typeof(selector) == "object"
|
||||||
|
children = args
|
||||||
|
args = selector
|
||||||
|
selector = ""
|
||||||
|
|
||||||
|
h (\div.field + selector), args, children
|
||||||
|
|
||||||
form: (method, url, content) ->
|
form: (method, url, content) ->
|
||||||
h \form.form {
|
h \form.form {
|
||||||
|
@ -4,24 +4,28 @@ Modal = require './modal.ls'
|
|||||||
UUID = require "uuid/v4"
|
UUID = require "uuid/v4"
|
||||||
bulma = require "./bulma.ls"
|
bulma = require "./bulma.ls"
|
||||||
|
|
||||||
|
{field, control, label, button, tag, input, select} = bulma
|
||||||
|
|
||||||
col-to-lines = (column, self) ->
|
col-to-lines = (column, self) ->
|
||||||
h \div.field.has-addons {
|
field \.has-addons {
|
||||||
key: "field" + column.id
|
key: "column.#{column.id}"
|
||||||
} [
|
} [
|
||||||
h \p.control.is-expanded [
|
control \.is-expanded [
|
||||||
h \input.input {
|
input {
|
||||||
key: "input" + column.id
|
key: "input" + column.id
|
||||||
value: column.title
|
value: column.title
|
||||||
oninput: (e) ->
|
oninput: (e) ->
|
||||||
self.extra_properties.columns.find((.id == column.id)).title := e.target.value
|
self.extra_properties.columns.find((.id == column.id)).title := e.target.value
|
||||||
} [ ]
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
h \div.control.button.is-danger.is-outlined {
|
control [
|
||||||
key: "button" + column.id
|
button \.is-danger.is-outlined {
|
||||||
onclick: ->
|
key: "button" + column.id
|
||||||
self.extra_properties.columns := self.extra_properties.columns.filter((.id != column.id))
|
onclick: ->
|
||||||
} [ "DELETE" ]
|
self.extra_properties.columns := self.extra_properties.columns.filter((.id != column.id))
|
||||||
|
} [ "DELETE" ]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
user-form-selection = (self, user) ->
|
user-form-selection = (self, user) ->
|
||||||
@ -86,10 +90,10 @@ ProjectCreationModal = (project, todod-ws, users) ->
|
|||||||
content-render: (self) ->
|
content-render: (self) ->
|
||||||
h \div.form [
|
h \div.form [
|
||||||
|
|
||||||
bulma.field [
|
field [
|
||||||
bulma.label "Project title"
|
label "Project title"
|
||||||
|
|
||||||
h \input.input {
|
input {
|
||||||
value: self.title
|
value: self.title
|
||||||
oninput: (e) ->
|
oninput: (e) ->
|
||||||
self.title := e.target.value
|
self.title := e.target.value
|
||||||
@ -111,36 +115,41 @@ ProjectCreationModal = (project, todod-ws, users) ->
|
|||||||
|
|
||||||
h \hr []
|
h \hr []
|
||||||
|
|
||||||
h \aside.menu [
|
field [
|
||||||
h \p.menu-label [ "Permissions" ]
|
label "Permissions"
|
||||||
h \ul.menu-list Object.keys(self.permissions).map (permission) ->
|
|
||||||
h \li {
|
h \table.table.is-fullwidth.is-striped [
|
||||||
key: "permission" + permission
|
h \tbody [
|
||||||
} [
|
for permission, uids of self.permissions
|
||||||
h \p self.permissions[permission].map (e, index) ->
|
for uid in uids
|
||||||
if index == 0
|
h \tr {key: uid.to-string!} [
|
||||||
"Permissions '" + permission + "': " + e + ", "
|
h \td [
|
||||||
else
|
uid.to-string!
|
||||||
"" + e + ", "
|
]
|
||||||
]
|
|
||||||
|
h \td.is-narrow [
|
||||||
|
permission
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
h \hr []
|
h \hr []
|
||||||
|
|
||||||
h \p [ "Adding new user" ]
|
# FIXME: This is supposed to go in a .field, right?
|
||||||
|
label "Adding new user"
|
||||||
|
|
||||||
h \div.field.has-addons {
|
field \.has-addons { key: \new-user } [
|
||||||
key: "adding-user"
|
control [
|
||||||
} [
|
select {
|
||||||
h \div.select.control [
|
|
||||||
h \select {
|
|
||||||
onchange: (e) ->
|
onchange: (e) ->
|
||||||
self.tmp.new-user-permission.permission := e.target.value
|
self.tmp.new-user-permission.permission := e.target.value
|
||||||
} permission-groups.map (permission) -> permission-to-form-selection self, permission
|
} permission-groups.map (permission) -> permission-to-form-selection self, permission
|
||||||
]
|
]
|
||||||
|
|
||||||
h \div.select.control.is-expanded [
|
control \.is-expanded [
|
||||||
h \select {
|
select \.is-fullwidth {
|
||||||
onchange: (e) ->
|
onchange: (e) ->
|
||||||
self.tmp.new-user-permission.uid := e.target.value
|
self.tmp.new-user-permission.uid := e.target.value
|
||||||
} [
|
} [
|
||||||
@ -150,39 +159,39 @@ ProjectCreationModal = (project, todod-ws, users) ->
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
h \div.control.button.is-success.is-outlined {
|
control [
|
||||||
onclick: ->
|
button \.is-success.is-outlined {
|
||||||
if self.tmp.new-user-permission.uid == void || self.tmp.new-user-permission.uid == "-"
|
onclick: ->
|
||||||
console.log "adding an user permission on the kanban: failed, no user selected"
|
if self.tmp.new-user-permission.uid == void || self.tmp.new-user-permission.uid == "-"
|
||||||
else
|
console.log "adding an user permission on the kanban: failed, no user selected"
|
||||||
# TODO:
|
else
|
||||||
# adding the permissions in self.permissions
|
# TODO:
|
||||||
# then editing the project in the db via todod-ws
|
# adding the permissions in self.permissions
|
||||||
permissions-add self, self.tmp.new-user-permission.permission, self.tmp.new-user-permission.uid
|
# then editing the project in the db via todod-ws
|
||||||
} [ "+" ]
|
permissions-add self, self.tmp.new-user-permission.permission, self.tmp.new-user-permission.uid
|
||||||
|
} [ "+" ]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
h \hr []
|
h \hr []
|
||||||
|
|
||||||
h \p [ "Choose the columns" ]
|
label [ "Columns" ]
|
||||||
|
|
||||||
for dom in (self.extra_properties.columns.map (column) -> col-to-lines column, self)
|
for dom in (self.extra_properties.columns.map (column) -> col-to-lines column, self)
|
||||||
dom
|
dom
|
||||||
|
|
||||||
h \hr []
|
h \hr []
|
||||||
|
|
||||||
h \div.field.has-addons {
|
field \.has-addons { key: \new-column } [
|
||||||
key: "adding-field"
|
control \.is-expanded [
|
||||||
} [
|
input {
|
||||||
h \p.control.is-expanded [
|
|
||||||
h \input.input {
|
|
||||||
value: self.tmp.new-column-input.title
|
value: self.tmp.new-column-input.title
|
||||||
oninput: (e) ->
|
oninput: (e) ->
|
||||||
self.tmp.new-column-input.title := e.target.value
|
self.tmp.new-column-input.title := e.target.value
|
||||||
} [ ]
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
h \div.control.button.is-success.is-outlined {
|
button \.is-success.is-outlined {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
new-col = {
|
new-col = {
|
||||||
id: UUID!
|
id: UUID!
|
||||||
|
Loading…
Reference in New Issue
Block a user