rev |
line source |
bsw@211
|
1 local issue = param.get("issue", "table")
|
bsw@213
|
2 local initiative_id = param.get("initiative_id", atom.integer)
|
bsw@211
|
3
|
bsw@211
|
4 local initiatives = issue.initiatives
|
bsw@211
|
5
|
bsw@211
|
6 local interested_members_selector = Member:new_selector()
|
bsw@211
|
7 :join("direct_interest_snapshot", "dis", { "dis.issue_id = ? AND dis.member_id = member.id and dis.event = (select latest_snapshot_event from issue where id = ?)", issue.id, issue.id })
|
bsw@211
|
8 :add_field("dis.weight", "weight")
|
bsw@211
|
9 :add_order_by("dis.weight DESC")
|
bsw@211
|
10 local interested_members = interested_members_selector:exec()
|
bsw@211
|
11
|
bsw@211
|
12 local interest = issue.interest
|
bsw@211
|
13
|
bsw@211
|
14 local trustees = Member:new_selector()
|
bsw@211
|
15 :add_field("delegation_chain.*")
|
bsw@211
|
16 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, " .. tostring(issue.id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
|
bsw@211
|
17 :add_order_by("index")
|
bsw@211
|
18 :exec()
|
bsw@211
|
19
|
bsw@211
|
20 local delegating_interest = issue.delegating_interest
|
bsw@211
|
21
|
bsw@211
|
22 ui.box{ class = "issue", content = function()
|
bsw@211
|
23
|
bsw@212
|
24 ui.box_row{ class = "issue_id head", content = function() ui.box_col{ class = "head", content = function()
|
bsw@211
|
25 ui.link{
|
bsw@211
|
26 module = "lf2", view = "issue", id = issue.id,
|
bsw@211
|
27 content = _("Issue ##{id}", { id = issue.id })
|
bsw@211
|
28 }
|
bsw@211
|
29 end } end }
|
bsw@211
|
30
|
bsw@213
|
31 ui.box_row{ class = "unit_name head2", content = function() ui.box_col{ content = function()
|
bsw@211
|
32 ui.link{
|
bsw@211
|
33 module = "lf2", view = "unit", id = 1,
|
bsw@211
|
34 content = "DE / Berlin / Friedrichshain-Kreuzberg"
|
bsw@211
|
35 }
|
bsw@211
|
36 end } end }
|
bsw@211
|
37
|
bsw@213
|
38 ui.box_row{ class = "area_name head2", content = function() ui.box_col{ content = function()
|
bsw@211
|
39 ui.link{
|
bsw@211
|
40 module = "lf2", view = "area", id = issue.area_id,
|
bsw@211
|
41 content = issue.area.name
|
bsw@211
|
42 }
|
bsw@211
|
43 end } end }
|
bsw@211
|
44
|
bsw@213
|
45 ui.box_row{ class = "policy_name head2", content = function() ui.box_col{ content = function()
|
bsw@211
|
46 ui.link{
|
bsw@211
|
47 module = "lf2", view = "policy", id = issue.policy_id,
|
bsw@211
|
48 content = issue.policy.name
|
bsw@211
|
49 }
|
bsw@211
|
50 end } end }
|
bsw@211
|
51
|
bsw@211
|
52 ui.box_row{ class = "time_left", content = function()
|
bsw@211
|
53 ui.box_col{ content = issue.closed and _("Closed since #{date}", { date = format.date(issue.closed.date) }) or _("#{time_left} left", { time_left = issue.state_time_left }) }
|
bsw@211
|
54 end }
|
bsw@211
|
55
|
bsw@211
|
56 ui.box_row{ class = "interest hoverbutton_container", content = function() ui.box_col{ content = function()
|
bsw@211
|
57 if interest then
|
bsw@211
|
58 ui.image{ static = "lf2/icon_star.png" }
|
bsw@211
|
59 if issue.closed then
|
bsw@211
|
60 slot.put(" ", _"You were interested in this issue")
|
bsw@211
|
61 else
|
bsw@211
|
62 slot.put(" ", _"You are interested in this issue")
|
bsw@211
|
63 end
|
bsw@211
|
64 else
|
bsw@213
|
65 if not issue.closed and not issue.fully_frozen then
|
bsw@213
|
66 ui.image{ static = "lf2/icon_star_grey.png" }
|
bsw@213
|
67 end
|
bsw@211
|
68 slot.put(_"You are not interested in this issue")
|
bsw@211
|
69 end
|
bsw@211
|
70
|
bsw@211
|
71 if issue.closed then
|
bsw@211
|
72 ui.container{ attr = { class = "hoverbutton noaction"}, content = function()
|
bsw@211
|
73 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
74 slot.put(" ", encode.html(_"This issue is closed"))
|
bsw@211
|
75 end }
|
bsw@211
|
76 end }
|
bsw@211
|
77 elseif issue.fully_frozen then
|
bsw@211
|
78 ui.container{ attr = { class = "hoverbutton noaction"}, content = function()
|
bsw@211
|
79 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
80 slot.put(" ", encode.html(_"This issue is in voting"))
|
bsw@211
|
81 end }
|
bsw@211
|
82 end }
|
bsw@211
|
83 else
|
bsw@211
|
84 if interest then
|
bsw@211
|
85 ui.link{
|
bsw@211
|
86 module = "interest", action = "update", params = { issue_id = issue.id, delete = true },
|
bsw@211
|
87 routing = { default = {
|
bsw@213
|
88 mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id,
|
bsw@211
|
89 } },
|
bsw@211
|
90 attr = { class = "hoverbutton red"},
|
bsw@211
|
91 content = function()
|
bsw@211
|
92 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
93 ui.image{ static = "lf2/icon_star_crossed.png" }
|
bsw@211
|
94 slot.put(" ", encode.html(_"Remove my interest"))
|
bsw@211
|
95 end }
|
bsw@211
|
96 end
|
bsw@211
|
97 }
|
bsw@211
|
98
|
bsw@211
|
99 else
|
bsw@211
|
100 ui.link{
|
bsw@211
|
101 module = "interest", action = "update", params = { issue_id = issue.id },
|
bsw@211
|
102 routing = { default = {
|
bsw@213
|
103 mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id,
|
bsw@211
|
104 } },
|
bsw@211
|
105 attr = { class = "hoverbutton green"},
|
bsw@211
|
106 content = function()
|
bsw@211
|
107 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
108 ui.image{ static = "lf2/icon_star.png" }
|
bsw@211
|
109 slot.put(" ", encode.html(_"Add my interest"))
|
bsw@211
|
110 end
|
bsw@211
|
111 }
|
bsw@211
|
112 end }
|
bsw@211
|
113
|
bsw@211
|
114 end
|
bsw@211
|
115 end
|
bsw@211
|
116 end } end }
|
bsw@211
|
117
|
bsw@211
|
118 ui.box_row{ class = "delegation hoverbutton_container", content = function() ui.box_col{ content = function()
|
bsw@213
|
119 if trustees[1].scope_out then
|
bsw@213
|
120 if trustees[1].disabled_out == false then
|
bsw@213
|
121 if trustees[1].scope_out == "issue" then
|
bsw@213
|
122 slot.put(encode.html(_"You have delegated this issue"))
|
bsw@213
|
123 elseif trustees[1].scope_out == "area" then
|
bsw@213
|
124 slot.put(encode.html(_"You have delegated this area"))
|
bsw@213
|
125 elseif trustees[1].scope_out == "global" then
|
bsw@213
|
126 slot.put(encode.html(_"You have delegated globally"))
|
bsw@213
|
127 end
|
bsw@213
|
128 else
|
bsw@213
|
129 if trustees[1].scope_out == "issue" then
|
bsw@213
|
130 slot.put(encode.html(_"Issue delegation abandoned"))
|
bsw@213
|
131 elseif trustees[1].scope_out == "area" then
|
bsw@213
|
132 slot.put(encode.html(_"Area delegation abandoned"))
|
bsw@213
|
133 elseif trustees[1].scope_out == "global" then
|
bsw@213
|
134 slot.put(encode.html(_"Global delegation abandoned"))
|
bsw@213
|
135 end
|
bsw@211
|
136 end
|
bsw@211
|
137 else
|
bsw@211
|
138 slot.put(encode.html(_"No delegation active"))
|
bsw@211
|
139 end
|
bsw@211
|
140
|
bsw@211
|
141 if issue.closed then
|
bsw@211
|
142 ui.container{ attr = { class = "hoverbutton noaction"}, content = function()
|
bsw@211
|
143 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
144 slot.put(" ", encode.html(_"This issue is closed"))
|
bsw@211
|
145 end }
|
bsw@211
|
146 end }
|
bsw@211
|
147 else
|
bsw@213
|
148 if #trustees > 1 then
|
bsw@213
|
149 ui.link{
|
bsw@213
|
150 module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id },
|
bsw@213
|
151 attr = { class = "hoverbutton red"}, content = function()
|
bsw@211
|
152 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
153 ui.image{ static = "lf2/icon_delegation.png" }
|
bsw@213
|
154 slot.put(" ", encode.html(_"Change issue delegation..."))
|
bsw@211
|
155 end }
|
bsw@211
|
156 end }
|
bsw@211
|
157
|
bsw@211
|
158 else
|
bsw@213
|
159 ui.link{
|
bsw@213
|
160 module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id },
|
bsw@213
|
161 attr = { class = "hoverbutton green"}, content = function()
|
bsw@211
|
162 ui.container{ attr = { class = "content"}, content = function()
|
bsw@211
|
163 ui.image{ static = "lf2/icon_delegation.png" }
|
bsw@213
|
164 slot.put(" ")
|
bsw@213
|
165 slot.put(" ", encode.html(_"Set issue delegation..."))
|
bsw@213
|
166
|
bsw@211
|
167 end }
|
bsw@211
|
168 end }
|
bsw@211
|
169
|
bsw@211
|
170 end
|
bsw@211
|
171 end
|
bsw@211
|
172
|
bsw@211
|
173 end } end }
|
bsw@213
|
174
|
bsw@213
|
175 if #trustees > 1 then
|
bsw@211
|
176 ui.box_row{ class = "delegation", content = function() ui.box_col{ content = function()
|
bsw@211
|
177 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
|
bsw@211
|
178 end } end }
|
bsw@211
|
179 end
|
bsw@211
|
180
|
bsw@211
|
181 end }
|