liquid_feedback_frontend
view app/main/issue/show.lua @ 1404:f99e7df399e6
Text case change
| author | bsw | 
|---|---|
| date | Mon Aug 13 19:52:00 2018 +0200 (2018-08-13) | 
| parents | 32cc544d5a5b | 
| children | 7ab60da388fe | 
 line source
     1 local issue = Issue:by_id ( param.get_id () )
     3 if not issue then
     4   return execute.view { module = "index", view = "404" }
     5 end
     7 app.current_issue = issue
     9 issue.area:load_delegation_info_once_for_member_id(app.session.member_id)
    11 execute.view{ module = "issue", view = "_head", params = { issue = issue } }
    13 local initiatives = issue.initiatives
    15 if app.session.member_id then
    16   issue:load_everything_for_member_id ( app.session.member_id )
    17   initiatives:load_everything_for_member_id ( app.session.member_id )
    18 end
    20 if not app.html_title.title then
    21   app.html_title.title = _("Issue ##{id}", { id = issue.id })
    22 end
    24 ui.grid{ content = function()
    26   ui.cell_main{ content = function()
    28     ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
    29       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    30         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Competing initiatives" }
    31       end }
    32       execute.view {
    33         module = "initiative", view = "_list",
    34         params = { 
    35           issue = issue,
    36           initiatives = initiatives
    37         }
    38       }
    39     end }
    41     ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
    43       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    44         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Details" }
    45       end }
    47       ui.container{ attr = { class = "mdl-card__content" }, content = function()
    48         local policy = issue.policy
    49         ui.form{
    50           record = issue,
    51           readonly = true,
    52           attr = { class = "sectionRow form" },
    53           content = function()
    54             if issue.snapshot then
    55               ui.field.timestamp{ label = _"Last counting:", value = issue.snapshot }
    56             end
    57             ui.field.text{       label = _"Population",            name = "population" }
    58             ui.field.timestamp{  label = _"Created at",            name = "created" }
    59             if policy.polling then
    60               ui.field.text{       label = _"Admission time",        value = _"Implicitly admitted" }
    61             else
    62               ui.field.text{       label = _"Minimum admission time",        value = format.interval_text(issue.min_admission_time_text) }
    63               ui.field.text{       label = _"Maximum admission time",        value = format.interval_text(issue.max_admission_time_text) }
    64               ui.field.text{ label = _"Issue quorum", value = issue.issue_quorum }
    65             end
    66             if issue.accepted then
    67               ui.field.timestamp{  label = _"Accepted at",           name = "accepted" }
    68             end
    69             ui.field.text{       label = _"Discussion time",       value = format.interval_text(issue.discussion_time_text) }
    70             if issue.half_frozen then
    71               ui.field.timestamp{  label = _"Half frozen at",        name = "half_frozen" }
    72             end
    73             ui.field.text{       label = _"Verification time",     value = format.interval_text(issue.verification_time_text) }
    74             ui.field.text{
    75               label   = _"Initiative quorum",
    76               value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den)
    77             }
    78             if issue.fully_frozen then
    79               ui.field.timestamp{  label = _"Fully frozen at",       name = "fully_frozen" }
    80             end
    81             ui.field.text{       label = _"Voting time",           value = format.interval_text(issue.voting_time_text) }
    82             if issue.closed then
    83               ui.field.timestamp{  label = _"Closed",                name = "closed" }
    84             end
    85           end
    86         }
    88         if issue.initiatives[1].rank == 1 then
    89           execute.view{ module = "initiative", view = "_sidebar_state", params = {
    90             initiative = issue.initiatives[1]
    91           } }
    92         end
    94       end }
    96     end }
    98   end }
   100   ui.cell_sidebar{ content = function()
   101     if config.logo then
   102       config.logo()
   103     end
   104     execute.view {
   105       module = "issue", view = "_sidebar", 
   106       params = {
   107         issue = issue,
   108         member = app.session.member
   109       }
   110     }
   112     execute.view {
   113       module = "issue", view = "_sidebar_whatcanido", 
   114       params = {
   115         issue = issue,
   116         member = app.session.member
   117       }
   118     }
   120     if not config.voting_only or issue.state ~= "voting" then
   121       execute.view { 
   122         module = "issue", view = "_sidebar_members", params = {
   123           issue = issue
   124         }
   125       }
   126     end
   127   end }
   129 end }
