liquid_feedback_frontend
view app/main/draft/new.lua @ 694:ccd85e7d7ac2
Optical improvements
| author | bsw | 
|---|---|
| date | Tue Jun 26 18:27:27 2012 +0200 (2012-06-26) | 
| parents | 6e13a7da16b5 | 
| children | 99852ec8ee37 | 
 line source
     1 slot.put_into("title", _"Edit draft")
     3 local initiative = Initiative:by_id(param.get("initiative_id"))
     5 slot.select("actions", function()
     6   ui.link{
     7     content = function()
     8         ui.image{ static = "icons/16/cancel.png" }
     9         slot.put(_"Cancel")
    10     end,
    11     module = "initiative",
    12     view = "show",
    13     id = initiative.id
    14   }
    15 end)
    19 ui.form{
    20   record = initiative.current_draft,
    21   attr = { class = "vertical" },
    22   module = "draft",
    23   action = "add",
    24   params = { initiative_id = initiative.id },
    25   routing = {
    26     ok = {
    27       mode = "redirect",
    28       module = "initiative",
    29       view = "show",
    30       id = initiative.id
    31     }
    32   },
    33   content = function()
    35     ui.field.text{ label = _"Unit", value = initiative.issue.area.unit.name, readonly = true }
    36     ui.field.text{ label = _"Area", value = initiative.issue.area.name, readonly = true }
    37     ui.field.text{ label = _"Policy", value = initiative.issue.policy.name, readonly = true }
    38     ui.field.text{ label = _"Issue", value = _("Issue ##{id}", { id = initiative.issue.id } ), readonly = true }
    39     slot.put("<br />")
    40     ui.field.text{ label = _"Initiative", value = initiative.name, readonly = true }
    42     if param.get("preview") then
    43       ui.container{
    44         attr = { class = "draft_content wiki" },
    45         content = function()
    46           slot.put(format.wiki_text(param.get("content"), param.get("formatting_engine")))
    47         end
    48       }
    49       slot.put("<br />")
    50       ui.submit{ text = _"Save" }
    51       slot.put("<br />")
    52       slot.put("<br />")
    53     end
    54     slot.put("<br />")
    57     ui.field.select{
    58       label = _"Wiki engine",
    59       name = "formatting_engine",
    60       foreign_records = {
    61         { id = "rocketwiki", name = "RocketWiki" },
    62         { id = "compat", name = _"Traditional wiki syntax" }
    63       },
    64       attr = {id = "formatting_engine"},
    65       foreign_id = "id",
    66       foreign_name = "name"
    67     }
    68     ui.tag{
    69       tag = "div",
    70       content = function()
    71         ui.tag{
    72           tag = "label",
    73           attr = { class = "ui_field_label" },
    74           content = function() slot.put(" ") end,
    75         }
    76         ui.tag{
    77           content = function()
    78             ui.link{
    79               text = _"Syntax help",
    80               module = "help",
    81               view = "show",
    82               id = "wikisyntax",
    83               attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    84             }
    85             slot.put(" ")
    86             ui.link{
    87               text = _"(new window)",
    88               module = "help",
    89               view = "show",
    90               id = "wikisyntax",
    91               attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    92             }
    93           end
    94         }
    95       end
    96     }
    97     ui.field.text{
    98       label = _"Content",
    99       name = "content",
   100       multiline = true,
   101       attr = { style = "height: 50ex;" },
   102       value = param.get("content")
   103    }
   105     ui.submit{ name = "preview", text = _"Preview" }
   106     ui.submit{ text = _"Save" }
   107   end
   108 }
