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