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@301
|
33 module = "unit",
|
bsw@301
|
34 view = "show",
|
bsw@301
|
35 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@317
|
44 attr = { class = "issue_policy_info" },
|
bsw@271
|
45 content = function()
|
bsw@272
|
46
|
bsw@272
|
47 ui.link{
|
bsw@272
|
48 text = issue.policy.name,
|
bsw@272
|
49 module = "policy",
|
bsw@272
|
50 view = "show",
|
bsw@272
|
51 id = issue.policy.id
|
bsw@272
|
52 }
|
bsw@272
|
53
|
bsw@271
|
54 slot.put(" · ")
|
bsw@271
|
55 ui.tag{ content = issue.state_name }
|
bsw@271
|
56
|
bsw@273
|
57 if issue.state_time_left then
|
bsw@273
|
58 slot.put(" · ")
|
bsw@346
|
59 ui.tag{ content = _("#{time_left} left", {
|
bsw@346
|
60 time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day")
|
bsw@346
|
61 }) }
|
bsw@271
|
62 end
|
bsw@271
|
63
|
bsw@271
|
64 end
|
bsw@271
|
65 }
|
bsw@271
|
66
|
bsw@271
|
67
|
bsw@271
|
68 end)
|
bsw@271
|
69
|
bsw/jbe@4
|
70 slot.select("actions", function()
|
bsw/jbe@5
|
71
|
bsw@51
|
72 if app.session.member_id then
|
bsw@51
|
73
|
bsw@281
|
74 if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
|
bsw@51
|
75 local text
|
bsw@51
|
76 if not direct_voter then
|
bsw@51
|
77 text = _"Vote now"
|
bsw@51
|
78 else
|
bsw@51
|
79 text = _"Change vote"
|
bsw@51
|
80 end
|
bsw@51
|
81 ui.link{
|
bsw@51
|
82 content = function()
|
bsw@51
|
83 ui.image{ static = "icons/16/email_open.png" }
|
bsw@51
|
84 slot.put(text)
|
bsw@51
|
85 end,
|
bsw@51
|
86 module = "vote",
|
bsw@51
|
87 view = "list",
|
bsw@51
|
88 params = { issue_id = issue.id }
|
bsw@51
|
89 }
|
bsw/jbe@19
|
90 end
|
bsw/jbe@5
|
91
|
bsw/jbe@5
|
92 execute.view{
|
bsw@51
|
93 module = "interest",
|
bsw/jbe@5
|
94 view = "_show_box",
|
bsw@339
|
95 params = { issue = issue, initiative = initiative }
|
bsw/jbe@5
|
96 }
|
bsw@7
|
97
|
bsw@51
|
98 if not issue.closed then
|
bsw@51
|
99 execute.view{
|
bsw@51
|
100 module = "delegation",
|
bsw@51
|
101 view = "_show_box",
|
poelzi@111
|
102 params = { issue_id = issue.id,
|
poelzi@111
|
103 initiative_id = initiative and initiative.id or nil}
|
bsw@51
|
104 }
|
bsw@51
|
105 end
|
bsw@51
|
106
|
bsw@51
|
107 end
|
bsw/jbe@4
|
108
|
bsw@10
|
109 if config.issue_discussion_url_func then
|
bsw@10
|
110 local url = config.issue_discussion_url_func(issue)
|
bsw@10
|
111 ui.link{
|
bsw@10
|
112 attr = { target = "_blank" },
|
bsw@10
|
113 external = url,
|
bsw@10
|
114 content = function()
|
bsw@10
|
115 ui.image{ static = "icons/16/comments.png" }
|
bsw@10
|
116 slot.put(_"Discussion on issue")
|
bsw@10
|
117 end,
|
bsw@10
|
118 }
|
bsw@10
|
119 end
|
bsw@286
|
120
|
bsw@286
|
121 if config.etherpad and app.session.member then
|
bsw@286
|
122 local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id
|
bsw@286
|
123 ui.link{
|
bsw@286
|
124 attr = { target = "_blank" },
|
bsw@286
|
125 external = url,
|
bsw@286
|
126 content = function()
|
bsw@286
|
127 ui.image{ static = "icons/16/comments.png" }
|
bsw@286
|
128 slot.put(_"Issue pad")
|
bsw@286
|
129 end,
|
bsw@286
|
130 }
|
bsw@286
|
131 end
|
bsw@286
|
132
|
bsw/jbe@4
|
133 end)
|
bsw/jbe@4
|
134
|
bsw@281
|
135 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
|
bsw@272
|
136 slot.select("actions", function()
|
bsw@272
|
137 if not issue.fully_frozen and not issue.closed then
|
bsw@272
|
138 ui.link{
|
bsw@272
|
139 image = { static = "icons/16/script_add.png" },
|
bsw@272
|
140 attr = { class = "action" },
|
bsw@272
|
141 text = _"Create alternative initiative",
|
bsw@272
|
142 module = "initiative",
|
bsw@272
|
143 view = "new",
|
bsw@272
|
144 params = { issue_id = issue.id }
|
bsw@272
|
145 }
|
bsw@272
|
146 end
|
bsw@272
|
147 end)
|
bsw@272
|
148 end
|
bsw/jbe@4
|
149
|
bsw@271
|
150 local issue = param.get("issue", "table")
|
bsw@271
|
151
|
bsw@60
|
152 if config.public_access_issue_head and not app.session.member_id then
|
bsw@60
|
153 config.public_access_issue_head(issue)
|
bsw@60
|
154 end
|
bsw/jbe@6
|
155
|
bsw@281
|
156 if app.session.member_id and issue.state == 'voting' and not direct_voter
|
bsw@281
|
157 and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
|
bsw@281
|
158 then
|
bsw/jbe@6
|
159 ui.container{
|
bsw/jbe@6
|
160 attr = { class = "voting_active_info" },
|
bsw/jbe@6
|
161 content = function()
|
bsw/jbe@6
|
162 slot.put(_"Voting for this issue is currently running!")
|
bsw/jbe@6
|
163 slot.put(" ")
|
bsw@51
|
164 if app.session.member_id then
|
bsw@51
|
165 ui.link{
|
bsw@51
|
166 content = function()
|
bsw@51
|
167 slot.put(_"Vote now")
|
bsw@51
|
168 end,
|
bsw@51
|
169 module = "vote",
|
bsw@51
|
170 view = "list",
|
bsw@51
|
171 params = { issue_id = issue.id }
|
bsw@51
|
172 }
|
bsw@51
|
173 end
|
bsw/jbe@6
|
174 end
|
bsw/jbe@6
|
175 }
|
bsw/jbe@6
|
176 slot.put("<br />")
|
bsw/jbe@6
|
177 end
|
bsw/jbe@6
|
178
|