| rev | 
   line source | 
| 
bsw@1045
 | 
     1 local issue = Issue:by_id ( param.get_id () )
 | 
| 
bsw@1045
 | 
     2 
 | 
| 
bsw@1045
 | 
     3 if not issue then
 | 
| 
bsw/jbe@1309
 | 
     4   return execute.view { module = "index", view = "404" }
 | 
| 
bsw@1045
 | 
     5 end
 | 
| 
bsw@1045
 | 
     6 
 | 
| 
bsw/jbe@1309
 | 
     7 app.current_issue = issue
 | 
| 
bsw/jbe@1309
 | 
     8 
 | 
| 
bsw/jbe@1309
 | 
     9 issue.area:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw/jbe@1309
 | 
    10 
 | 
| 
bsw/jbe@1309
 | 
    11 execute.view{ module = "issue", view = "_head", params = { issue = issue } }
 | 
| 
bsw/jbe@1309
 | 
    12 
 | 
| 
bsw@1045
 | 
    13 local initiatives = issue.initiatives
 | 
| 
bsw@1045
 | 
    14 
 | 
| 
bsw@548
 | 
    15 if app.session.member_id then
 | 
| 
bsw@1045
 | 
    16   issue:load_everything_for_member_id ( app.session.member_id )
 | 
| 
bsw@1045
 | 
    17   initiatives:load_everything_for_member_id ( app.session.member_id )
 | 
| 
bsw@548
 | 
    18 end
 | 
| 
bsw/jbe@0
 | 
    19 
 | 
| 
jorges@106
 | 
    20 if not app.html_title.title then
 | 
| 
bsw@1045
 | 
    21   app.html_title.title = _("Issue ##{id}", { id = issue.id })
 | 
| 
jorges@106
 | 
    22 end
 | 
| 
jorges@103
 | 
    23 
 | 
| 
bsw/jbe@1309
 | 
    24 ui.grid{ content = function()
 | 
| 
bsw/jbe@1309
 | 
    25   
 | 
| 
bsw/jbe@1309
 | 
    26   ui.cell_main{ content = function()
 | 
| 
bsw/jbe@0
 | 
    27 
 | 
| 
bsw/jbe@1309
 | 
    28     ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    29       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    30         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Competing initiatives" }
 | 
| 
bsw/jbe@1309
 | 
    31       end }
 | 
| 
bsw/jbe@1309
 | 
    32       execute.view {
 | 
| 
bsw/jbe@1309
 | 
    33         module = "initiative", view = "_list",
 | 
| 
bsw/jbe@1309
 | 
    34         params = { 
 | 
| 
bsw/jbe@1309
 | 
    35           issue = issue,
 | 
| 
bsw/jbe@1309
 | 
    36           initiatives = initiatives
 | 
| 
bsw/jbe@1309
 | 
    37         }
 | 
| 
bsw/jbe@1309
 | 
    38       }
 | 
| 
bsw/jbe@1309
 | 
    39     end }
 | 
| 
bsw@719
 | 
    40 
 | 
| 
bsw/jbe@1309
 | 
    41     ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    42 
 | 
| 
bsw/jbe@1309
 | 
    43       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    44         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Details" }
 | 
| 
bsw/jbe@1309
 | 
    45       end }
 | 
| 
bsw@1045
 | 
    46 
 | 
| 
bsw/jbe@1309
 | 
    47       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    48         local policy = issue.policy
 | 
| 
bsw/jbe@1309
 | 
    49         ui.form{
 | 
| 
bsw/jbe@1309
 | 
    50           record = issue,
 | 
| 
bsw/jbe@1309
 | 
    51           readonly = true,
 | 
| 
bsw/jbe@1309
 | 
    52           attr = { class = "sectionRow form" },
 | 
| 
bsw/jbe@1309
 | 
    53           content = function()
 | 
| 
bsw@1629
 | 
    54             local latest_snapshot = Snapshot:latest_by_issue_id(issue.id)
 | 
| 
bsw@1629
 | 
    55             if latest_snapshot then
 | 
| 
bsw@1629
 | 
    56               ui.field.timestamp{ label = _"Last counting:", value = latest_snapshot.calculated }
 | 
| 
bsw/jbe@1309
 | 
    57             end
 | 
| 
bsw/jbe@1309
 | 
    58             ui.field.text{       label = _"Population",            name = "population" }
 | 
| 
bsw/jbe@1309
 | 
    59             ui.field.timestamp{  label = _"Created at",            name = "created" }
 | 
| 
bsw/jbe@1309
 | 
    60             if policy.polling then
 | 
| 
bsw/jbe@1309
 | 
    61               ui.field.text{       label = _"Admission time",        value = _"Implicitly admitted" }
 | 
| 
bsw/jbe@1309
 | 
    62             else
 | 
| 
bsw/jbe@1309
 | 
    63               ui.field.text{       label = _"Minimum admission time",        value = format.interval_text(issue.min_admission_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    64               ui.field.text{       label = _"Maximum admission time",        value = format.interval_text(issue.max_admission_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    65               ui.field.text{ label = _"Issue quorum", value = issue.issue_quorum }
 | 
| 
bsw/jbe@1309
 | 
    66             end
 | 
| 
bsw/jbe@1309
 | 
    67             if issue.accepted then
 | 
| 
bsw/jbe@1309
 | 
    68               ui.field.timestamp{  label = _"Accepted at",           name = "accepted" }
 | 
| 
bsw/jbe@1309
 | 
    69             end
 | 
| 
bsw/jbe@1309
 | 
    70             ui.field.text{       label = _"Discussion time",       value = format.interval_text(issue.discussion_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    71             if issue.half_frozen then
 | 
| 
bsw/jbe@1309
 | 
    72               ui.field.timestamp{  label = _"Half frozen at",        name = "half_frozen" }
 | 
| 
bsw/jbe@1309
 | 
    73             end
 | 
| 
bsw/jbe@1309
 | 
    74             ui.field.text{       label = _"Verification time",     value = format.interval_text(issue.verification_time_text) }
 | 
| 
bsw@1436
 | 
    75             local quorums = {}
 | 
| 
bsw@1436
 | 
    76             if policy.initiative_quorum_num / policy.initiative_quorum_den then
 | 
| 
bsw@1436
 | 
    77               table.insert(quorums, format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den))
 | 
| 
bsw@1436
 | 
    78             end
 | 
| 
bsw@1436
 | 
    79             if policy.initiative_quorum then
 | 
| 
bsw@1436
 | 
    80               table.insert(quorums, policy.initiative_quorum)
 | 
| 
bsw@1436
 | 
    81             end
 | 
| 
bsw/jbe@1309
 | 
    82             ui.field.text{
 | 
| 
bsw/jbe@1309
 | 
    83               label   = _"Initiative quorum",
 | 
| 
bsw@1436
 | 
    84               value = table.concat(quorums, " / ")
 | 
| 
bsw/jbe@1309
 | 
    85             }
 | 
| 
bsw/jbe@1309
 | 
    86             if issue.fully_frozen then
 | 
| 
bsw/jbe@1309
 | 
    87               ui.field.timestamp{  label = _"Fully frozen at",       name = "fully_frozen" }
 | 
| 
bsw/jbe@1309
 | 
    88             end
 | 
| 
bsw/jbe@1309
 | 
    89             ui.field.text{       label = _"Voting time",           value = format.interval_text(issue.voting_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    90             if issue.closed then
 | 
| 
bsw/jbe@1309
 | 
    91               ui.field.timestamp{  label = _"Closed",                name = "closed" }
 | 
| 
bsw/jbe@1309
 | 
    92             end
 | 
| 
bsw/jbe@1309
 | 
    93           end
 | 
| 
bsw/jbe@1309
 | 
    94         }
 | 
| 
bsw@719
 | 
    95 
 | 
| 
bsw/jbe@1309
 | 
    96         if issue.initiatives[1].rank == 1 then
 | 
| 
bsw/jbe@1309
 | 
    97           execute.view{ module = "initiative", view = "_sidebar_state", params = {
 | 
| 
bsw/jbe@1309
 | 
    98             initiative = issue.initiatives[1]
 | 
| 
bsw/jbe@1309
 | 
    99           } }
 | 
| 
bsw/jbe@1309
 | 
   100         end
 | 
| 
bsw/jbe@1309
 | 
   101     
 | 
| 
bsw/jbe@1309
 | 
   102       end }
 | 
| 
bsw/jbe@1309
 | 
   103       
 | 
| 
bsw/jbe@1309
 | 
   104     end }
 | 
| 
bsw/jbe@1309
 | 
   105       
 | 
| 
bsw/jbe@1309
 | 
   106   end }
 | 
| 
bsw/jbe@1309
 | 
   107 
 | 
| 
bsw/jbe@1309
 | 
   108   ui.cell_sidebar{ content = function()
 | 
| 
bsw/jbe@1309
 | 
   109     if config.logo then
 | 
| 
bsw/jbe@1309
 | 
   110       config.logo()
 | 
| 
bsw/jbe@1309
 | 
   111     end
 | 
| 
bsw@1602
 | 
   112     
 | 
| 
bsw@1045
 | 
   113     execute.view {
 | 
| 
bsw/jbe@1309
 | 
   114       module = "issue", view = "_sidebar", 
 | 
| 
bsw/jbe@1309
 | 
   115       params = {
 | 
| 
bsw@1045
 | 
   116         issue = issue,
 | 
| 
bsw/jbe@1309
 | 
   117         member = app.session.member
 | 
| 
bsw@1045
 | 
   118       }
 | 
| 
bsw@1045
 | 
   119     }
 | 
| 
bsw/jbe@19
 | 
   120 
 | 
| 
bsw/jbe@1309
 | 
   121     execute.view {
 | 
| 
bsw/jbe@1309
 | 
   122       module = "issue", view = "_sidebar_whatcanido", 
 | 
| 
bsw/jbe@1309
 | 
   123       params = {
 | 
| 
bsw/jbe@1309
 | 
   124         issue = issue,
 | 
| 
bsw/jbe@1309
 | 
   125         member = app.session.member
 | 
| 
bsw/jbe@1309
 | 
   126       }
 | 
| 
bsw/jbe@1309
 | 
   127     }
 | 
| 
bsw/jbe@1309
 | 
   128 
 | 
| 
bsw/jbe@1309
 | 
   129     if not config.voting_only or issue.state ~= "voting" then
 | 
| 
bsw/jbe@1309
 | 
   130       execute.view { 
 | 
| 
bsw/jbe@1309
 | 
   131         module = "issue", view = "_sidebar_members", params = {
 | 
| 
bsw/jbe@1309
 | 
   132           issue = issue
 | 
| 
bsw@1045
 | 
   133         }
 | 
| 
bsw@1045
 | 
   134       }
 | 
| 
bsw@1045
 | 
   135     end
 | 
| 
bsw/jbe@1309
 | 
   136   end }
 | 
| 
bsw/jbe@19
 | 
   137 
 | 
| 
bsw/jbe@1309
 | 
   138 end }
 |