2019-12-04 23:30:12 +01:00
|
|
|
|
|
|
|
h = require 'maquette' .h
|
|
|
|
|
|
|
|
# formulaire création de listes
|
|
|
|
# formulaire création de tâches
|
|
|
|
# confirmation de suppression de listes, de tâches, de colonnes
|
|
|
|
|
|
|
|
Modal = (args) ->
|
2019-12-06 04:07:19 +01:00
|
|
|
self = {
|
|
|
|
modal-args: args.modal-args || {}
|
|
|
|
visible: args.visible || false
|
|
|
|
content: args.content || []
|
|
|
|
background-args: args.background-args || []
|
|
|
|
on-validation: args.on-validation || ->
|
|
|
|
on-cancellation: args.on-cancellation || ->
|
|
|
|
validation-label: args.validation-label || "Ok"
|
|
|
|
cancellation-label: args.cancellation-label || "Cancel"
|
|
|
|
}
|
2019-12-04 23:30:12 +01:00
|
|
|
|
|
|
|
self.render = ->
|
|
|
|
console.log "Rendering a modal: ", self, self.content
|
|
|
|
|
|
|
|
is-active = (if self.visible == true then \.is-active else "")
|
|
|
|
h \div.modal + is-active, self.modal-args, [
|
|
|
|
h \div.modal-background self.background-args
|
|
|
|
|
|
|
|
h \div.modal-content {} [
|
|
|
|
h \div.box [
|
|
|
|
self.content
|
|
|
|
|
|
|
|
h \hr []
|
|
|
|
|
|
|
|
h \div.columns {} [
|
|
|
|
h \div.column {} [
|
|
|
|
h \button.button.is-fullwidth {
|
|
|
|
onclick: ->
|
|
|
|
self.visible := false
|
|
|
|
self.on-validation self
|
|
|
|
} [ self.validation-label ]
|
|
|
|
]
|
|
|
|
h \div.column {} [
|
|
|
|
h \button.button.is-fullwidth {
|
|
|
|
onclick: ->
|
|
|
|
self.visible := false
|
|
|
|
self.on-cancellation self
|
|
|
|
} [ self.cancellation-label ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
h \button.button.modal-close {
|
|
|
|
aria-label: "close"
|
|
|
|
onclick: ->
|
|
|
|
self.visible := false
|
|
|
|
self.on-cancellation self
|
|
|
|
} []
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
self
|
|
|
|
|
|
|
|
module.exports = Modal
|