| rev | line source | 
| bsw/jbe@4 | 1 local issue = param.get("issue", "table") | 
| poelzi@111 | 2 local initiative = param.get("initiative", "table") | 
| bsw/jbe@4 | 3 | 
| bsw@51 | 4 local direct_voter | 
| bsw@51 | 5 | 
| bsw@51 | 6 if app.session.member_id then | 
| bsw@51 | 7   direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id) | 
| bsw@51 | 8 end | 
| bsw/jbe@19 | 9 | 
| bsw/jbe@52 | 10 if config.feature_rss_enabled then | 
| bsw/jbe@52 | 11   util.html_rss_head{ title = _"Initiatives in this issue (last created first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id } } | 
| bsw/jbe@52 | 12   util.html_rss_head{ title = _"Initiatives in this issue (last updated first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id, order = "last_updated" } } | 
| bsw/jbe@52 | 13 end | 
| bsw/jbe@4 | 14 | 
| bsw/jbe@19 | 15 slot.select("title", function() | 
| bsw@271 | 16   ui.link{ | 
| bsw@271 | 17     content = _("Issue ##{id}", { id = issue.id }), | 
| bsw@271 | 18     module = "issue", | 
| bsw@271 | 19     view = "show", | 
| bsw@271 | 20     id = issue.id | 
| bsw@271 | 21   } | 
| bsw@273 | 22   slot.put(" · ") | 
| bsw/jbe@4 | 23   ui.link{ | 
| bsw/jbe@19 | 24     content = issue.area.name, | 
| bsw/jbe@4 | 25     module = "area", | 
| bsw/jbe@4 | 26     view = "show", | 
| bsw/jbe@4 | 27     id = issue.area.id | 
| bsw/jbe@4 | 28   } | 
| bsw@271 | 29   if not config.single_unit_id then | 
| bsw@271 | 30     slot.put(" · ") | 
| bsw@271 | 31     ui.link{ | 
| bsw@271 | 32       content = issue.area.unit.name, | 
| bsw@271 | 33       module = "area", | 
| bsw@271 | 34       view = "list", | 
| bsw@271 | 35       params = { unit_id = issue.area.unit_id } | 
| bsw@271 | 36     } | 
| bsw@271 | 37   end | 
| bsw/jbe@5 | 38 end) | 
| bsw/jbe@5 | 39 | 
| bsw/jbe@4 | 40 | 
| bsw@271 | 41 slot.select("title2", function() | 
| bsw@271 | 42   ui.tag{ | 
| bsw@271 | 43     tag = "div", | 
| bsw@271 | 44     content = function() | 
| bsw@272 | 45 | 
| bsw@272 | 46       ui.link{ | 
| bsw@272 | 47         text = issue.policy.name, | 
| bsw@272 | 48         module = "policy", | 
| bsw@272 | 49         view = "show", | 
| bsw@272 | 50         id = issue.policy.id | 
| bsw@272 | 51       } | 
| bsw@272 | 52 | 
| bsw@271 | 53       slot.put(" · ") | 
| bsw@271 | 54       ui.tag{ content = issue.state_name } | 
| bsw@271 | 55 | 
| bsw@273 | 56       if issue.state_time_left then | 
| bsw@273 | 57         slot.put(" · ") | 
| bsw@273 | 58         ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left }) } | 
| bsw@271 | 59       end | 
| bsw@271 | 60 | 
| bsw@271 | 61     end | 
| bsw@271 | 62   } | 
| bsw@271 | 63 | 
| bsw@271 | 64 | 
| bsw@271 | 65 end) | 
| bsw@271 | 66 | 
| bsw/jbe@4 | 67 slot.select("actions", function() | 
| bsw/jbe@5 | 68 | 
| bsw@51 | 69   if app.session.member_id then | 
| bsw@51 | 70 | 
| bsw@281 | 71     if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then | 
| bsw@51 | 72       local text | 
| bsw@51 | 73       if not direct_voter then | 
| bsw@51 | 74         text = _"Vote now" | 
| bsw@51 | 75       else | 
| bsw@51 | 76         text = _"Change vote" | 
| bsw@51 | 77       end | 
| bsw@51 | 78       ui.link{ | 
| bsw@51 | 79         content = function() | 
| bsw@51 | 80           ui.image{ static = "icons/16/email_open.png" } | 
| bsw@51 | 81           slot.put(text) | 
| bsw@51 | 82         end, | 
| bsw@51 | 83         module = "vote", | 
| bsw@51 | 84         view = "list", | 
| bsw@51 | 85         params = { issue_id = issue.id } | 
| bsw@51 | 86       } | 
| bsw/jbe@19 | 87     end | 
| bsw/jbe@5 | 88 | 
| bsw/jbe@5 | 89     execute.view{ | 
| bsw@51 | 90       module = "interest", | 
| bsw/jbe@5 | 91       view = "_show_box", | 
| bsw@51 | 92       params = { issue = issue } | 
| bsw/jbe@5 | 93     } | 
| bsw@7 | 94 | 
| bsw@51 | 95     if not issue.closed then | 
| bsw@51 | 96       execute.view{ | 
| bsw@51 | 97         module = "delegation", | 
| bsw@51 | 98         view = "_show_box", | 
| poelzi@111 | 99         params = { issue_id = issue.id, | 
| poelzi@111 | 100                    initiative_id = initiative and initiative.id or nil} | 
| bsw@51 | 101       } | 
| bsw@51 | 102     end | 
| bsw@51 | 103 | 
| bsw@51 | 104   end | 
| bsw/jbe@4 | 105 | 
| bsw@10 | 106   if config.issue_discussion_url_func then | 
| bsw@10 | 107     local url = config.issue_discussion_url_func(issue) | 
| bsw@10 | 108     ui.link{ | 
| bsw@10 | 109       attr = { target = "_blank" }, | 
| bsw@10 | 110       external = url, | 
| bsw@10 | 111       content = function() | 
| bsw@10 | 112         ui.image{ static = "icons/16/comments.png" } | 
| bsw@10 | 113         slot.put(_"Discussion on issue") | 
| bsw@10 | 114       end, | 
| bsw@10 | 115     } | 
| bsw@10 | 116   end | 
| bsw/jbe@4 | 117 end) | 
| bsw/jbe@4 | 118 | 
| bsw@281 | 119 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then | 
| bsw@272 | 120   slot.select("actions", function() | 
| bsw@272 | 121     if not issue.fully_frozen and not issue.closed then | 
| bsw@272 | 122       ui.link{ | 
| bsw@272 | 123         image  = { static = "icons/16/script_add.png" }, | 
| bsw@272 | 124         attr   = { class = "action" }, | 
| bsw@272 | 125         text   = _"Create alternative initiative", | 
| bsw@272 | 126         module = "initiative", | 
| bsw@272 | 127         view   = "new", | 
| bsw@272 | 128         params = { issue_id = issue.id } | 
| bsw@272 | 129       } | 
| bsw@272 | 130     end | 
| bsw@272 | 131   end) | 
| bsw@272 | 132 end | 
| bsw/jbe@4 | 133 | 
| bsw@271 | 134 local issue = param.get("issue", "table") | 
| bsw@271 | 135 | 
| bsw@60 | 136 if config.public_access_issue_head and not app.session.member_id then | 
| bsw@60 | 137   config.public_access_issue_head(issue) | 
| bsw@60 | 138 end | 
| bsw/jbe@6 | 139 | 
| bsw@281 | 140 if app.session.member_id and issue.state == 'voting' and not direct_voter | 
| bsw@281 | 141   and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) | 
| bsw@281 | 142 then | 
| bsw/jbe@6 | 143   ui.container{ | 
| bsw/jbe@6 | 144     attr = { class = "voting_active_info" }, | 
| bsw/jbe@6 | 145     content = function() | 
| bsw/jbe@6 | 146       slot.put(_"Voting for this issue is currently running!") | 
| bsw/jbe@6 | 147       slot.put(" ") | 
| bsw@51 | 148       if app.session.member_id then | 
| bsw@51 | 149         ui.link{ | 
| bsw@51 | 150           content = function() | 
| bsw@51 | 151             slot.put(_"Vote now") | 
| bsw@51 | 152           end, | 
| bsw@51 | 153           module = "vote", | 
| bsw@51 | 154           view = "list", | 
| bsw@51 | 155           params = { issue_id = issue.id } | 
| bsw@51 | 156         } | 
| bsw@51 | 157       end | 
| bsw/jbe@6 | 158     end | 
| bsw/jbe@6 | 159   } | 
| bsw/jbe@6 | 160   slot.put("<br />") | 
| bsw/jbe@6 | 161 end | 
| bsw/jbe@6 | 162 |