liquid_feedback_frontend
view app/main/draft/show.lua @ 1418:22cf6b9b0698
Use correct css class 2
| author | bsw | 
|---|---|
| date | Thu Aug 30 10:45:01 2018 +0200 (2018-08-30) | 
| parents | 32cc544d5a5b | 
| children | 17e7082c377a | 
 line source
     1 local draft = Draft:new_selector():add_where{ "id = ?", param.get_id() }:optional_object_mode():exec()
     3 if not draft then
     4   execute.view { module = "index", view = "404" }
     5   request.set_status("404 Not Found")
     6   return
     7 end
    10 local source = param.get("source", atom.boolean)
    12 execute.view{
    13   module = "issue",
    14   view = "_head",
    15   params = { issue = draft.initiative.issue }
    16 }
    18 ui.section( function()
    20   ui.sectionHead( function()
    21     ui.link{
    22       module = "initiative", view = "show", id = draft.initiative.id,
    23       content = function ()
    24         ui.heading { 
    25           level = 1,
    26           content = draft.initiative.display_name
    27         }
    28       end
    29     }
    30     ui.container { attr = { class = "right" }, content = function()
    31       if source then
    32         ui.link{
    33           content = _"Rendered",
    34           module = "draft",
    35           view = "show",
    36           id = param.get_id(),
    37           params = { source = false }
    38         }
    39       else
    40         ui.link{
    41           content = _"Source",
    42           module = "draft",
    43           view = "show",
    44           id = param.get_id(),
    45           params = { source = true }
    46         }
    47       end
    48     end }
    49     ui.heading { level = 2, content = _("Draft revision #{id}", { id = draft.id } ) }
    50   end)
    52   if config.render_external_reference and config.render_external_reference.draft then
    53     config.render_external_reference.draft(draft, function (callback)
    54       ui.sectionRow(callback)
    55     end)
    56   end
    58   ui.sectionRow( function()
    60     execute.view{
    61       module = "draft",
    62       view = "_show",
    63       params = { draft = draft, source = source }
    64     }
    65   end)
    66 end)
