75 lines
1.7 KiB
Plaintext
75 lines
1.7 KiB
Plaintext
|
|
h = require 'maquette' .h
|
|
|
|
module.exports = {
|
|
box: (args, children) ->
|
|
h \div.box args, children
|
|
title: (level, args, label) ->
|
|
if not label
|
|
label = args
|
|
args = {}
|
|
|
|
h "div.title.is-#{level}", args, [label]
|
|
label: (args, label) ->
|
|
if not label
|
|
label = args
|
|
args = {}
|
|
|
|
h \label.label args, [label]
|
|
input: (args, children) ->
|
|
h \input.input args, children
|
|
|
|
# FIXME: Use only args and add args.label and args.input?
|
|
# Or maybe args.name and args.type could be used directly?
|
|
field: (args, children) ->
|
|
h \div.field args, children
|
|
|
|
form: (method, url, content) ->
|
|
h \form.form {
|
|
action: url
|
|
method: method
|
|
}, content
|
|
|
|
asking-modal: (model, args, content) ->
|
|
console.log "Rendering a modal: ", args, content
|
|
is-active = (if model.current-modal == true then \.is-active else "")
|
|
h \div.modal + is-active, args, [
|
|
h \div.modal-background (args.background || [])
|
|
|
|
h \div.modal-content {} [
|
|
content
|
|
|
|
h \hr []
|
|
|
|
h \div.columns {} [
|
|
h \div.column {} [
|
|
h \button.button.is-success.is-fullwidth {
|
|
onclick: ->
|
|
model.current-modal := false
|
|
} [
|
|
h \span.icon.has-text-success [ h \i.fas.fa-check-square [] ]
|
|
]
|
|
]
|
|
h \div.column {} [
|
|
# h \button.button.is-warning.is-fullwidth {
|
|
# onclick: ->
|
|
# model.current-modal := false
|
|
# } [
|
|
# h \span.icon.has-text-danger [ h \i.fas.fa-ban [] ]
|
|
# ]
|
|
h \span.icon.has-text-danger {
|
|
onclick: ->
|
|
model.current-modal := false
|
|
} [ h \i.fas.fa-ban [] ]
|
|
]
|
|
]
|
|
h \button.button.modal-close {
|
|
aria-label: "close"
|
|
onclick: ->
|
|
model.current-modal := false
|
|
} []
|
|
]
|
|
]
|
|
}
|
|
|