liquid_feedback_frontend
view app/main/draft/_show.lua @ 230:0196bc0fcc39
merge
| author | jbe | 
|---|---|
| date | Thu Oct 06 16:16:26 2011 +0200 (2011-10-06) | 
| parents | cc7650c7053f | 
| children | aec9df5b4cd3 | 
 line source
     1 local draft = param.get("draft", "table")
     2 local source = param.get("source", atom.boolean)
     4 ui.form{
     5   attr = { class = "vertical" },
     6   record = draft,
     7   readonly = true,
     8   content = function()
    10     if app.session.member_id or config.public_access == "pseudonym" then
    11       if draft.author then
    12         -- ugly workaround for getting html into a replaced string und to the user
    13         ui.container{label = _"Last author", label_attr={class="ui_field_label"}, content = function()
    14             local str = _("#{author} at #{date}",
    15                             {author = string.format('<a href="%s">%s</a>',
    16                                                     encode.url{
    17                                                       module    = "member",
    18                                                       view      = "show",
    19                                                       id        = draft.author.id,
    20                                                     },
    21                                                     encode.html(draft.author.name)),
    22                              date = encode.html(format.timestamp(draft.created))
    23                             }
    24                         )
    25             slot.put("<span>", str, "</span>")
    26           end
    27         }
    28       else
    29         text = _("#{author} at #{date}", {
    30           author = encode.html(draft.author_name),
    31           date = format.timestamp(draft.created)
    32         })
    33         ui.field.text{label = _"Last author", value = text }
    34       end
    35     else
    36       ui.field.text{
    37         label = _"Last author",
    38         value = _(
    39           "#{author} at #{date}", {
    40             author = _"[not displayed public]",
    41             date = format.timestamp(draft.created)
    42           }
    43         )
    44       }
    45     end
    47     ui.container{
    48       attr = { class = "draft_content wiki" },
    49       content = function()
    50         if source then
    51           ui.tag{
    52             tag = "pre",
    53             content = draft.content
    54           }
    55         else
    56           slot.put(draft:get_content("html"))
    57         end
    58       end
    59     }
    60   end
    61 }
