annotate app/main/draft/show.lua @ 1282:0bd5142b9c5e
Fix syntax errors, added default hiding to notification settings
 | author | 
 bsw | 
 | date | 
 Mon Apr 18 09:42:19 2016 +0200 (2016-04-18) | 
 | parents | 
 fede09736f2b  | 
 | children | 
 32cc544d5a5b  | 
 
 | rev | 
   line source | 
| 
bsw/jbe@0
 | 
     1 local draft = Draft:new_selector():add_where{ "id = ?", param.get_id() }:single_object_mode():exec()
 | 
| 
poelzi@160
 | 
     2 local source = param.get("source", atom.boolean)
 | 
| 
poelzi@160
 | 
     3 
 | 
| 
poelzi@160
 | 
     4 execute.view{
 | 
| 
bsw@1045
 | 
     5   module = "issue",
 | 
| 
poelzi@160
 | 
     6   view = "_head",
 | 
| 
bsw@1045
 | 
     7   params = { issue = draft.initiative.issue }
 | 
| 
poelzi@160
 | 
     8 }
 | 
| 
poelzi@160
 | 
     9 
 | 
| 
bsw@1045
 | 
    10 ui.section( function()
 | 
| 
bsw@1045
 | 
    11   
 | 
| 
bsw@1045
 | 
    12   ui.sectionHead( function()
 | 
| 
poelzi@160
 | 
    13     ui.link{
 | 
| 
bsw@1045
 | 
    14       module = "initiative", view = "show", id = draft.initiative.id,
 | 
| 
bsw@1045
 | 
    15       content = function ()
 | 
| 
bsw@1045
 | 
    16         ui.heading { 
 | 
| 
bsw@1045
 | 
    17           level = 1,
 | 
| 
bsw@1045
 | 
    18           content = draft.initiative.display_name
 | 
| 
bsw@1045
 | 
    19         }
 | 
| 
bsw@1045
 | 
    20       end
 | 
| 
poelzi@160
 | 
    21     }
 | 
| 
bsw@1045
 | 
    22     ui.container { attr = { class = "right" }, content = function()
 | 
| 
bsw@1045
 | 
    23       if source then
 | 
| 
bsw@1045
 | 
    24         ui.link{
 | 
| 
bsw@1045
 | 
    25           content = _"Rendered",
 | 
| 
bsw@1045
 | 
    26           module = "draft",
 | 
| 
bsw@1045
 | 
    27           view = "show",
 | 
| 
bsw@1045
 | 
    28           id = param.get_id(),
 | 
| 
bsw@1045
 | 
    29           params = { source = false }
 | 
| 
bsw@1045
 | 
    30         }
 | 
| 
bsw@1045
 | 
    31       else
 | 
| 
bsw@1045
 | 
    32         ui.link{
 | 
| 
bsw@1045
 | 
    33           content = _"Source",
 | 
| 
bsw@1045
 | 
    34           module = "draft",
 | 
| 
bsw@1045
 | 
    35           view = "show",
 | 
| 
bsw@1045
 | 
    36           id = param.get_id(),
 | 
| 
bsw@1045
 | 
    37           params = { source = true }
 | 
| 
bsw@1045
 | 
    38         }
 | 
| 
bsw@1045
 | 
    39       end
 | 
| 
bsw@1045
 | 
    40     end }
 | 
| 
bsw@1045
 | 
    41     ui.heading { level = 2, content = _("Draft revision #{id}", { id = draft.id } ) }
 | 
| 
bsw@1045
 | 
    42   end)
 | 
| 
bsw@1045
 | 
    43   
 | 
| 
bsw@1209
 | 
    44   if config.render_external_reference and config.render_external_reference.draft then
 | 
| 
bsw@1209
 | 
    45     config.render_external_reference.draft(draft, function (callback)
 | 
| 
bsw@1209
 | 
    46       ui.sectionRow(callback)
 | 
| 
bsw@1209
 | 
    47     end)
 | 
| 
bsw@1209
 | 
    48   end
 | 
| 
bsw@1209
 | 
    49   
 | 
| 
bsw@1045
 | 
    50   ui.sectionRow( function()
 | 
| 
bsw@1045
 | 
    51   
 | 
| 
bsw@1045
 | 
    52     execute.view{
 | 
| 
bsw@1045
 | 
    53       module = "draft",
 | 
| 
bsw@1045
 | 
    54       view = "_show",
 | 
| 
bsw@1045
 | 
    55       params = { draft = draft, source = source }
 | 
| 
bsw@1045
 | 
    56     }
 | 
| 
bsw@1045
 | 
    57   end)
 | 
| 
bsw@1045
 | 
    58 end)
 |