| 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/jbe@1309
 | 
    54             if issue.snapshot then
 | 
| 
bsw/jbe@1309
 | 
    55               ui.field.timestamp{ label = _"Last counting:", value = issue.snapshot }
 | 
| 
bsw/jbe@1309
 | 
    56             end
 | 
| 
bsw/jbe@1309
 | 
    57             ui.field.text{       label = _"Population",            name = "population" }
 | 
| 
bsw/jbe@1309
 | 
    58             ui.field.timestamp{  label = _"Created at",            name = "created" }
 | 
| 
bsw/jbe@1309
 | 
    59             if policy.polling then
 | 
| 
bsw/jbe@1309
 | 
    60               ui.field.text{       label = _"Admission time",        value = _"Implicitly admitted" }
 | 
| 
bsw/jbe@1309
 | 
    61             else
 | 
| 
bsw/jbe@1309
 | 
    62               ui.field.text{       label = _"Minimum admission time",        value = format.interval_text(issue.min_admission_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    63               ui.field.text{       label = _"Maximum admission time",        value = format.interval_text(issue.max_admission_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    64               ui.field.text{ label = _"Issue quorum", value = issue.issue_quorum }
 | 
| 
bsw/jbe@1309
 | 
    65             end
 | 
| 
bsw/jbe@1309
 | 
    66             if issue.accepted then
 | 
| 
bsw/jbe@1309
 | 
    67               ui.field.timestamp{  label = _"Accepted at",           name = "accepted" }
 | 
| 
bsw/jbe@1309
 | 
    68             end
 | 
| 
bsw/jbe@1309
 | 
    69             ui.field.text{       label = _"Discussion time",       value = format.interval_text(issue.discussion_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    70             if issue.half_frozen then
 | 
| 
bsw/jbe@1309
 | 
    71               ui.field.timestamp{  label = _"Half frozen at",        name = "half_frozen" }
 | 
| 
bsw/jbe@1309
 | 
    72             end
 | 
| 
bsw/jbe@1309
 | 
    73             ui.field.text{       label = _"Verification time",     value = format.interval_text(issue.verification_time_text) }
 | 
| 
bsw@1436
 | 
    74             local quorums = {}
 | 
| 
bsw@1436
 | 
    75             if policy.initiative_quorum_num / policy.initiative_quorum_den then
 | 
| 
bsw@1436
 | 
    76               table.insert(quorums, format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den))
 | 
| 
bsw@1436
 | 
    77             end
 | 
| 
bsw@1436
 | 
    78             if policy.initiative_quorum then
 | 
| 
bsw@1436
 | 
    79               table.insert(quorums, policy.initiative_quorum)
 | 
| 
bsw@1436
 | 
    80             end
 | 
| 
bsw/jbe@1309
 | 
    81             ui.field.text{
 | 
| 
bsw/jbe@1309
 | 
    82               label   = _"Initiative quorum",
 | 
| 
bsw@1436
 | 
    83               value = table.concat(quorums, " / ")
 | 
| 
bsw/jbe@1309
 | 
    84             }
 | 
| 
bsw/jbe@1309
 | 
    85             if issue.fully_frozen then
 | 
| 
bsw/jbe@1309
 | 
    86               ui.field.timestamp{  label = _"Fully frozen at",       name = "fully_frozen" }
 | 
| 
bsw/jbe@1309
 | 
    87             end
 | 
| 
bsw/jbe@1309
 | 
    88             ui.field.text{       label = _"Voting time",           value = format.interval_text(issue.voting_time_text) }
 | 
| 
bsw/jbe@1309
 | 
    89             if issue.closed then
 | 
| 
bsw/jbe@1309
 | 
    90               ui.field.timestamp{  label = _"Closed",                name = "closed" }
 | 
| 
bsw/jbe@1309
 | 
    91             end
 | 
| 
bsw/jbe@1309
 | 
    92           end
 | 
| 
bsw/jbe@1309
 | 
    93         }
 | 
| 
bsw@719
 | 
    94 
 | 
| 
bsw/jbe@1309
 | 
    95         if issue.initiatives[1].rank == 1 then
 | 
| 
bsw/jbe@1309
 | 
    96           execute.view{ module = "initiative", view = "_sidebar_state", params = {
 | 
| 
bsw/jbe@1309
 | 
    97             initiative = issue.initiatives[1]
 | 
| 
bsw/jbe@1309
 | 
    98           } }
 | 
| 
bsw/jbe@1309
 | 
    99         end
 | 
| 
bsw/jbe@1309
 | 
   100     
 | 
| 
bsw/jbe@1309
 | 
   101       end }
 | 
| 
bsw/jbe@1309
 | 
   102       
 | 
| 
bsw/jbe@1309
 | 
   103     end }
 | 
| 
bsw/jbe@1309
 | 
   104       
 | 
| 
bsw/jbe@1309
 | 
   105   end }
 | 
| 
bsw/jbe@1309
 | 
   106 
 | 
| 
bsw/jbe@1309
 | 
   107   ui.cell_sidebar{ content = function()
 | 
| 
bsw/jbe@1309
 | 
   108     if config.logo then
 | 
| 
bsw/jbe@1309
 | 
   109       config.logo()
 | 
| 
bsw/jbe@1309
 | 
   110     end
 | 
| 
bsw@1045
 | 
   111     execute.view {
 | 
| 
bsw/jbe@1309
 | 
   112       module = "issue", view = "_sidebar", 
 | 
| 
bsw/jbe@1309
 | 
   113       params = {
 | 
| 
bsw@1045
 | 
   114         issue = issue,
 | 
| 
bsw/jbe@1309
 | 
   115         member = app.session.member
 | 
| 
bsw@1045
 | 
   116       }
 | 
| 
bsw@1045
 | 
   117     }
 | 
| 
bsw/jbe@19
 | 
   118 
 | 
| 
bsw/jbe@1309
 | 
   119     execute.view {
 | 
| 
bsw/jbe@1309
 | 
   120       module = "issue", view = "_sidebar_whatcanido", 
 | 
| 
bsw/jbe@1309
 | 
   121       params = {
 | 
| 
bsw/jbe@1309
 | 
   122         issue = issue,
 | 
| 
bsw/jbe@1309
 | 
   123         member = app.session.member
 | 
| 
bsw/jbe@1309
 | 
   124       }
 | 
| 
bsw/jbe@1309
 | 
   125     }
 | 
| 
bsw/jbe@1309
 | 
   126 
 | 
| 
bsw/jbe@1309
 | 
   127     if not config.voting_only or issue.state ~= "voting" then
 | 
| 
bsw/jbe@1309
 | 
   128       execute.view { 
 | 
| 
bsw/jbe@1309
 | 
   129         module = "issue", view = "_sidebar_members", params = {
 | 
| 
bsw/jbe@1309
 | 
   130           issue = issue
 | 
| 
bsw@1045
 | 
   131         }
 | 
| 
bsw@1045
 | 
   132       }
 | 
| 
bsw@1045
 | 
   133     end
 | 
| 
bsw/jbe@1309
 | 
   134   end }
 | 
| 
bsw/jbe@19
 | 
   135 
 | 
| 
bsw/jbe@1309
 | 
   136 end }
 |