bsw/jbe@4: slot.put_into("title", _"Edit draft")
bsw/jbe@0:
bsw@2: local initiative = Initiative:by_id(param.get("initiative_id"))
bsw/jbe@0:
bsw/jbe@4: slot.select("actions", function()
bsw/jbe@4: ui.link{
bsw/jbe@4: content = function()
bsw/jbe@4: ui.image{ static = "icons/16/cancel.png" }
bsw/jbe@4: slot.put(_"Cancel")
bsw/jbe@4: end,
bsw/jbe@4: module = "initiative",
bsw/jbe@4: view = "show",
bsw/jbe@4: id = initiative.id
bsw/jbe@4: }
bsw/jbe@4: end)
bsw/jbe@4:
bsw@95:
bsw@95:
bsw/jbe@0: ui.form{
bsw@2: record = initiative.current_draft,
bsw/jbe@0: attr = { class = "vertical" },
bsw/jbe@0: module = "draft",
bsw/jbe@0: action = "add",
bsw@2: params = { initiative_id = initiative.id },
bsw/jbe@0: routing = {
bsw@95: ok = {
bsw/jbe@0: mode = "redirect",
bsw/jbe@0: module = "initiative",
bsw/jbe@0: view = "show",
bsw@2: id = initiative.id
bsw/jbe@0: }
bsw/jbe@0: },
bsw/jbe@0: content = function()
bsw/jbe@0:
bsw/jbe@0: ui.field.text{ label = _"Author", value = app.session.member.name, readonly = true }
bsw@95:
bsw@95: if param.get("preview") then
bsw@95: ui.container{
bsw@95: attr = { class = "draft_content wiki" },
bsw@95: content = function()
bsw@95: slot.put(format.wiki_text(param.get("content"), param.get("formatting_engine")))
bsw@95: end
bsw@95: }
bsw@95: slot.put("
")
bsw@95: ui.submit{ text = _"Save" }
bsw@95: slot.put("
")
bsw@95: slot.put("
")
bsw@95: end
bsw@95: slot.put("
")
bsw@95:
bsw@95:
bsw/jbe@4: ui.field.select{
bsw/jbe@4: label = _"Wiki engine",
bsw/jbe@4: name = "formatting_engine",
bsw/jbe@4: foreign_records = {
bsw/jbe@4: { id = "rocketwiki", name = "RocketWiki" },
bsw/jbe@4: { id = "compat", name = _"Traditional wiki syntax" }
bsw/jbe@4: },
poelzi@133: attr = {id = "formatting_engine"},
bsw/jbe@4: foreign_id = "id",
bsw/jbe@4: foreign_name = "name"
bsw/jbe@4: }
poelzi@133: ui.tag{
poelzi@133: tag = "div",
poelzi@133: content = function()
poelzi@133: ui.tag{
poelzi@133: tag = "label",
poelzi@133: attr = { class = "ui_field_label" },
poelzi@133: content = function() slot.put(" ") end,
poelzi@133: }
poelzi@133: ui.tag{
poelzi@133: content = function()
poelzi@133: ui.link{
poelzi@133: text = _"Syntax help",
poelzi@133: module = "help",
poelzi@133: view = "show",
poelzi@133: id = "wikisyntax",
poelzi@133: attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
poelzi@133: }
poelzi@133: slot.put(" ")
poelzi@133: ui.link{
poelzi@133: text = _"(new window)",
poelzi@133: module = "help",
poelzi@133: view = "show",
poelzi@133: id = "wikisyntax",
poelzi@133: attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
poelzi@133: }
poelzi@133: end
poelzi@133: }
poelzi@133: end
poelzi@133: }
bsw@2: ui.field.text{
bsw@2: label = _"Content",
bsw@2: name = "content",
bsw@2: multiline = true,
bsw@95: attr = { style = "height: 50ex;" },
bsw@95: value = param.get("content")
bsw@2: }
bsw/jbe@0:
bsw@95: ui.submit{ name = "preview", text = _"Preview" }
bsw/jbe@0: ui.submit{ text = _"Save" }
bsw/jbe@0: end
bsw/jbe@0: }