| 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@1045 | 4   execute.view { module = "index", view = "404" } | 
| bsw@1045 | 5   request.set_status("404 Not Found") | 
| bsw@1045 | 6   return | 
| bsw@1045 | 7 end | 
| bsw@1045 | 8 | 
| bsw@1045 | 9 local initiatives = issue.initiatives | 
| bsw@1045 | 10 | 
| bsw@548 | 11 if app.session.member_id then | 
| bsw@1045 | 12   issue:load_everything_for_member_id ( app.session.member_id ) | 
| bsw@1045 | 13   initiatives:load_everything_for_member_id ( app.session.member_id ) | 
| bsw@548 | 14 end | 
| bsw/jbe@0 | 15 | 
| jorges@106 | 16 if not app.html_title.title then | 
| bsw@1045 | 17   app.html_title.title = _("Issue ##{id}", { id = issue.id }) | 
| jorges@106 | 18 end | 
| jorges@103 | 19 | 
| bsw@1045 | 20 execute.view { | 
| bsw@1045 | 21   module = "issue", view = "_head", | 
| bsw@1045 | 22   params = { issue = issue, member = app.session.member } | 
| bsw@1045 | 23 } | 
| bsw@2 | 24 | 
| bsw@1045 | 25 execute.view{ module = "issue", view = "_sidebar_state", params = { | 
| bsw@1045 | 26   issue = issue | 
| bsw@1045 | 27 } } | 
| bsw/jbe@0 | 28 | 
| bsw@1045 | 29 execute.view { | 
| bsw@1045 | 30   module = "issue", view = "_sidebar_whatcanido", params = { | 
| bsw@1045 | 31     issue = issue | 
| bsw@1045 | 32   } | 
| bsw@1045 | 33 } | 
| bsw@719 | 34 | 
| bsw@1045 | 35 execute.view { | 
| bsw@1045 | 36   module = "issue", view = "_sidebar_members", params = { | 
| bsw@1045 | 37     issue = issue | 
| bsw@1045 | 38   } | 
| bsw@1045 | 39 } | 
| bsw@1045 | 40 | 
| bsw@1045 | 41 ui.section( function () | 
| bsw@1045 | 42 | 
| bsw@1045 | 43   execute.view{ | 
| bsw@1045 | 44     module = "issue", view = "_head2", params = { | 
| bsw@1045 | 45       issue = issue | 
| bsw@719 | 46     } | 
| bsw@719 | 47   } | 
| bsw@719 | 48 | 
| bsw@1045 | 49   if issue.initiatives[1].rank == 1 then | 
| bsw@1045 | 50     execute.view{ module = "initiative", view = "_sidebar_state", params = { | 
| bsw@1045 | 51       initiative = issue.initiatives[1] | 
| bsw@1045 | 52     } } | 
| bsw@1045 | 53   end | 
| bsw@719 | 54 | 
| bsw@1045 | 55   ui.sectionRow( function () | 
| bsw@1045 | 56     execute.view { | 
| bsw@1045 | 57       module = "initiative", view = "_list", | 
| bsw@1045 | 58       params = { | 
| bsw@1045 | 59         issue = issue, | 
| bsw@1045 | 60         initiatives = initiatives | 
| bsw@1045 | 61       } | 
| bsw@1045 | 62     } | 
| bsw@1045 | 63   end ) | 
| bsw@1045 | 64 | 
| bsw@1045 | 65 end ) | 
| bsw/jbe@19 | 66 | 
| bsw@1045 | 67 ui.section(function() | 
| bsw@1045 | 68   ui.sectionHead( function() | 
| bsw@1045 | 69     ui.heading { level = 1, content = _"Details" } | 
| bsw@1045 | 70   end ) | 
| bsw@1045 | 71   local policy = issue.policy | 
| bsw@1045 | 72   ui.form{ | 
| bsw@1045 | 73     record = issue, | 
| bsw@1045 | 74     readonly = true, | 
| bsw@1045 | 75     attr = { class = "sectionRow form" }, | 
| bsw@1045 | 76     content = function() | 
| bsw@1045 | 77       if issue.snapshot then | 
| bsw@1045 | 78         ui.field.timestamp{ label = _"Last counting:", value = issue.snapshot } | 
| bsw@1045 | 79       end | 
| bsw@1045 | 80       ui.field.text{       label = _"Population",            name = "population" } | 
| bsw@1045 | 81       ui.field.timestamp{  label = _"Created at",            name = "created" } | 
| bsw@1045 | 82       if policy.polling then | 
| bsw@1045 | 83         ui.field.text{       label = _"Admission time",        value = _"Implicitly admitted" } | 
| bsw@1045 | 84       else | 
| bsw@1045 | 85         ui.field.text{       label = _"Admission time",        value = format.interval_text(issue.admission_time_text) } | 
| bsw@1045 | 86         ui.field.text{ | 
| bsw@1045 | 87           label = _"Issue quorum", | 
| bsw@1045 | 88           value = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) | 
| bsw@1045 | 89         } | 
| bsw@1045 | 90         if issue.population then | 
| bsw@1045 | 91           ui.field.text{ | 
| bsw@1045 | 92             label = _"Currently required", | 
| bsw@1045 | 93             value = math.ceil(issue.population * policy.issue_quorum_num / policy.issue_quorum_den) | 
| bsw@1045 | 94           } | 
| bsw@1045 | 95         end | 
| bsw@1045 | 96       end | 
| bsw@1045 | 97       if issue.accepted then | 
| bsw@1045 | 98         ui.field.timestamp{  label = _"Accepted at",           name = "accepted" } | 
| bsw@1045 | 99       end | 
| bsw@1045 | 100       ui.field.text{       label = _"Discussion time",       value = format.interval_text(issue.discussion_time_text) } | 
| bsw@1045 | 101       if issue.half_frozen then | 
| bsw@1045 | 102         ui.field.timestamp{  label = _"Half frozen at",        name = "half_frozen" } | 
| bsw@1045 | 103       end | 
| bsw@1045 | 104       ui.field.text{       label = _"Verification time",     value = format.interval_text(issue.verification_time_text) } | 
| bsw@1045 | 105       ui.field.text{ | 
| bsw@1045 | 106         label   = _"Initiative quorum", | 
| bsw@1045 | 107         value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) | 
| bsw@1045 | 108       } | 
| bsw@1045 | 109       if issue.population then | 
| bsw@1045 | 110         ui.field.text{ | 
| bsw@1045 | 111           label   = _"Currently required", | 
| bsw@1045 | 112           value = math.ceil(issue.population * (issue.policy.initiative_quorum_num / issue.policy.initiative_quorum_den)), | 
| bsw@1045 | 113         } | 
| bsw@1045 | 114       end | 
| bsw@1045 | 115       if issue.fully_frozen then | 
| bsw@1045 | 116         ui.field.timestamp{  label = _"Fully frozen at",       name = "fully_frozen" } | 
| bsw@1045 | 117       end | 
| bsw@1045 | 118       ui.field.text{       label = _"Voting time",           value = format.interval_text(issue.voting_time_text) } | 
| bsw@1045 | 119       if issue.closed then | 
| bsw@1045 | 120         ui.field.timestamp{  label = _"Closed",                name = "closed" } | 
| bsw@1045 | 121       end | 
| bsw@1045 | 122     end | 
| bsw@1045 | 123   } | 
| bsw/jbe@19 | 124 | 
| bsw@1045 | 125 end ) | 
| bsw@1045 | 126 |