callback function in the modal prototype
parent
7cfe504890
commit
5a8c6c6c4e
|
@ -5,11 +5,12 @@ h = require 'maquette' .h
|
||||||
# formulaire création de tâches
|
# formulaire création de tâches
|
||||||
# confirmation de suppression de listes, de tâches, de colonnes
|
# confirmation de suppression de listes, de tâches, de colonnes
|
||||||
|
|
||||||
Modal = (args) ->
|
Modal = (args, caller) ->
|
||||||
self = {
|
self = {
|
||||||
modal-args: args.modal-args || {}
|
modal-args: args.modal-args || {}
|
||||||
visible: args.visible || false
|
visible: args.visible || false
|
||||||
content: args.content || []
|
content: args.content || []
|
||||||
|
content-render: args.content-render || ->
|
||||||
background-args: args.background-args || []
|
background-args: args.background-args || []
|
||||||
on-validation: args.on-validation || ->
|
on-validation: args.on-validation || ->
|
||||||
on-cancellation: args.on-cancellation || ->
|
on-cancellation: args.on-cancellation || ->
|
||||||
|
@ -26,8 +27,11 @@ Modal = (args) ->
|
||||||
|
|
||||||
h \div.modal-content {} [
|
h \div.modal-content {} [
|
||||||
h \div.box [
|
h \div.box [
|
||||||
|
|
||||||
self.content
|
self.content
|
||||||
|
|
||||||
|
self.content-render caller
|
||||||
|
|
||||||
h \hr []
|
h \hr []
|
||||||
|
|
||||||
h \div.columns {} [
|
h \div.columns {} [
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
|
||||||
h = require 'maquette' .h
|
h = require 'maquette' .h
|
||||||
Modal = require './modal.ls'
|
Modal = require './modal.ls'
|
||||||
UUID = require "uuid/v4"
|
UUID = require "uuid/v4"
|
||||||
|
bulma = require "./bulma.ls"
|
||||||
|
|
||||||
ProjectCreationModal = (project, todod-ws) ->
|
ProjectCreationModal = (project, todod-ws) ->
|
||||||
|
|
||||||
self = {
|
self = {
|
||||||
title: project.title || ""
|
title: project.title || ""
|
||||||
|
new-user: "Coucou 2 le retour"
|
||||||
extra_properties:
|
extra_properties:
|
||||||
columns: project.extra_properties.columns || []
|
columns: project.extra_properties.columns || []
|
||||||
}
|
}
|
||||||
|
@ -15,53 +16,76 @@ ProjectCreationModal = (project, todod-ws) ->
|
||||||
+visible
|
+visible
|
||||||
new-column-input: "New column !"
|
new-column-input: "New column !"
|
||||||
|
|
||||||
content: h \div.form [
|
content-render: (self) ->
|
||||||
h \input.input {
|
h \div.form [
|
||||||
value: self.title
|
h \input.input {
|
||||||
oninput: (e) ->
|
value: self.title
|
||||||
self.title := e.target.value
|
oninput: (e) ->
|
||||||
}
|
self.title := e.target.value
|
||||||
|
}
|
||||||
|
|
||||||
h \aside.menu [
|
bulma.field [
|
||||||
h \p.menu-label [ "Choose the columns" ]
|
console.log "THEAFOEIOEAI JOAEJFOI JOJFOAEJ USER NAME: " + self.new-user
|
||||||
|
bulma.label "Valeur actuelle : " + self.new-user
|
||||||
|
bulma.label "Adding a user"
|
||||||
|
bulma.input {
|
||||||
|
value: self.new-user
|
||||||
|
oninput: (e) ->
|
||||||
|
self.new-user := e.target.value
|
||||||
|
console.log "NEW USER NAME: " + self.new-user
|
||||||
|
|
||||||
h \ul.menu-list self.extra_properties.columns.map (column) ->
|
name: \new-user
|
||||||
|
id: \user-add
|
||||||
h \li [
|
}
|
||||||
h \input.input {
|
]
|
||||||
key: column.id
|
|
||||||
value: column.title
|
|
||||||
oninput: (e) ->
|
|
||||||
self.extra_properties.columns.find((.id == column.id)).title := e.target.value
|
|
||||||
} [ ]
|
|
||||||
|
|
||||||
h \div.button {
|
|
||||||
onclick: ->
|
|
||||||
# TODO: create a new entry in self.extra_properties.columns
|
|
||||||
self.extra_properties.columns = self.extra_properties.select((.id != column.id))
|
|
||||||
} [ "X" ]
|
|
||||||
]
|
|
||||||
|
|
||||||
h \input.input {
|
h \input.input {
|
||||||
value: self.new-column-input
|
value: self.title
|
||||||
oninput: (e) ->
|
oninput: (e) ->
|
||||||
self.new-column-input := e.target.value
|
self.title := e.target.value
|
||||||
} [ ]
|
}
|
||||||
|
|
||||||
h \div.button {
|
h \aside.menu [
|
||||||
onclick: ->
|
h \p.menu-label [ "Choose the columns" ]
|
||||||
# TODO: create a new entry in self.extra_properties.columns
|
|
||||||
self.extra_properties.columns ++= [ self.new-column-input ]
|
h \ul.menu-list self.extra_properties.columns.map (column) ->
|
||||||
self.new-column-input := "New column !"
|
|
||||||
} [ "+" ]
|
h \li [
|
||||||
|
h \input.input {
|
||||||
|
key: column.id
|
||||||
|
value: column.title
|
||||||
|
oninput: (e) ->
|
||||||
|
self.extra_properties.columns.find((.id == column.id)).title := e.target.value
|
||||||
|
} [ ]
|
||||||
|
|
||||||
|
h \div.button {
|
||||||
|
onclick: ->
|
||||||
|
# TODO: create a new entry in self.extra_properties.columns
|
||||||
|
self.extra_properties.columns = self.extra_properties.select((.id != column.id))
|
||||||
|
} [ "X" ]
|
||||||
|
]
|
||||||
|
|
||||||
|
h \input.input {
|
||||||
|
value: self.new-column-input
|
||||||
|
oninput: (e) ->
|
||||||
|
self.new-column-input := e.target.value
|
||||||
|
} [ ]
|
||||||
|
|
||||||
|
h \div.button {
|
||||||
|
onclick: ->
|
||||||
|
# TODO: create a new entry in self.extra_properties.columns
|
||||||
|
self.extra_properties.columns ++= [ self.new-column-input ]
|
||||||
|
self.new-column-input := "New column !"
|
||||||
|
} [ "+" ]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
|
||||||
on-validation: ->
|
on-validation: ->
|
||||||
if project.id
|
if project.id
|
||||||
todod-ws.edit-list project.id, self
|
todod-ws.edit-list project.id, self
|
||||||
else
|
else
|
||||||
todod-ws.add-list self.title, self
|
todod-ws.add-list self.title, self
|
||||||
}
|
}, self
|
||||||
|
|
||||||
self.render = ->
|
self.render = ->
|
||||||
modal.render!
|
modal.render!
|
||||||
|
|
Loading…
Reference in New Issue