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@215
|
4 local alternative_initiatives = param.get("alternative_initiatives", "table")
|
bsw@215
|
5
|
bsw@211
|
6 local initiatives = issue.initiatives
|
bsw@211
|
7
|
bsw@211
|
8 local interested_members_selector = Member:new_selector()
|
bsw@211
|
9 :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
|
10 :add_field("dis.weight", "weight")
|
bsw@211
|
11 :add_order_by("dis.weight DESC")
|
bsw@211
|
12 local interested_members = interested_members_selector:exec()
|
bsw@211
|
13
|
bsw@211
|
14 local interest = issue.interest
|
bsw@211
|
15
|
bsw@211
|
16 local trustees = Member:new_selector()
|
bsw@211
|
17 :add_field("delegation_chain.*")
|
bsw@217
|
18 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, NULL, " .. tostring(issue.id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
|
bsw@211
|
19 :add_order_by("index")
|
bsw@211
|
20 :exec()
|
bsw@211
|
21
|
bsw@211
|
22 local delegating_interest = issue.delegating_interest
|
bsw@211
|
23
|
bsw@211
|
24 ui.box{ class = "issue", content = function()
|
bsw@211
|
25
|
bsw@217
|
26 ui.box_row{ class = "issue_id head", content = function() ui.box_col{ class = "head", content = function()
|
bsw@217
|
27 ui.link{
|
bsw@217
|
28 module = "lf2", view = "issue", id = issue.id,
|
bsw@217
|
29 content = _("Issue ##{id}", { id = issue.id })
|
bsw@217
|
30 }
|
bsw@217
|
31 end } end }
|
bsw@217
|
32
|
bsw@217
|
33 if not issue.closed then
|
bsw@217
|
34 ui.box_row{ class = "interest", content = function() ui.box_col{ content = function()
|
bsw@217
|
35 if interest then
|
bsw@218
|
36 local text
|
bsw@218
|
37 if issue.close then
|
bsw@218
|
38 text = _"You were interested"
|
bsw@218
|
39 else
|
bsw@218
|
40 text = _"You are interested"
|
bsw@218
|
41 end
|
bsw@218
|
42 ui.image{ static = "lf2/icon_star.png" }
|
bsw@218
|
43 slot.put(" ")
|
bsw@218
|
44 ui.tag{ content = text }
|
bsw@218
|
45 slot.put(" · ")
|
bsw@217
|
46 ui.link{
|
bsw@217
|
47 module = "interest", action = "update", params = { issue_id = issue.id, delete = true },
|
bsw@217
|
48 routing = { default = {
|
bsw@217
|
49 mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id,
|
bsw@217
|
50 } },
|
bsw@218
|
51 content = _"remove"
|
bsw@217
|
52 }
|
bsw@218
|
53 elseif delegating_interest then
|
bsw@218
|
54 local text
|
bsw@218
|
55 if issue.closed then
|
bsw@218
|
56 text = _"Someone in your delegation chain was interested"
|
bsw@218
|
57 else
|
bsw@218
|
58 text = _"Someone in your delegation chain is interested"
|
bsw@218
|
59 end
|
bsw@218
|
60 ui.image{ attr = { title = text, alt = text}, static = "lf2/icon_delegated_star.png" }
|
bsw@217
|
61 else
|
bsw@217
|
62 ui.link{
|
bsw@217
|
63 module = "interest", action = "update", params = { issue_id = issue.id },
|
bsw@217
|
64 routing = { default = {
|
bsw@217
|
65 mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id,
|
bsw@217
|
66 } },
|
bsw@217
|
67 content = _"Add my interest"
|
bsw@217
|
68 }
|
bsw@217
|
69 end
|
bsw@217
|
70 end } end }
|
bsw@217
|
71 end
|
bsw@217
|
72
|
bsw@218
|
73 if #trustees > 1 then
|
bsw@218
|
74 ui.box_row{ class = "delegation", content = function() ui.box_col{ content = function()
|
bsw@218
|
75 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small", issue_id = issue.id } }
|
bsw@218
|
76 end } end }
|
bsw@218
|
77 end
|
bsw@218
|
78
|
bsw@217
|
79 if not issue.closed then
|
bsw@217
|
80 ui.box_row{ class = "interest", content = function() ui.box_col{ content = function()
|
bsw@217
|
81 if #trustees > 1 and trustees[1].scope_out == "issue" then
|
bsw@217
|
82 ui.link{
|
bsw@217
|
83 module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id },
|
bsw@218
|
84 content = _"Change or remove delegation"
|
bsw@218
|
85 }
|
bsw@217
|
86 else
|
bsw@217
|
87 ui.link{
|
bsw@217
|
88 module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id },
|
bsw@218
|
89 content = _"Set issue delegation"
|
bsw@218
|
90 }
|
bsw@217
|
91 end
|
bsw@217
|
92
|
bsw@217
|
93 end } end }
|
bsw@217
|
94 end
|
bsw@217
|
95
|
bsw@217
|
96 ui.box_row{ class = "unit_name", content = function() ui.box_col{ content = function()
|
bsw@211
|
97 ui.link{
|
bsw@215
|
98 module = "lf2", view = "index", id = 1,
|
bsw@211
|
99 content = "DE / Berlin / Friedrichshain-Kreuzberg"
|
bsw@211
|
100 }
|
bsw@211
|
101 end } end }
|
bsw@211
|
102
|
bsw@217
|
103 ui.box_row{ class = "area_name", content = function() ui.box_col{ content = function()
|
bsw@211
|
104 ui.link{
|
bsw@211
|
105 module = "lf2", view = "area", id = issue.area_id,
|
bsw@211
|
106 content = issue.area.name
|
bsw@211
|
107 }
|
bsw@211
|
108 end } end }
|
bsw@211
|
109
|
bsw@216
|
110 ui.box_row{ class = "policy_name", content = function() ui.box_col{ content = function()
|
bsw@211
|
111 ui.link{
|
bsw@211
|
112 module = "lf2", view = "policy", id = issue.policy_id,
|
bsw@211
|
113 content = issue.policy.name
|
bsw@211
|
114 }
|
bsw@211
|
115 end } end }
|
bsw@211
|
116
|
bsw@216
|
117 ui.box_row{ class = "time_left", content = function()
|
bsw@216
|
118 ui.box_col{ class = "left", content = function()
|
bsw@216
|
119 ui.tag{ content = issue.state_name }
|
bsw@216
|
120 slot.put(" · ")
|
bsw@216
|
121 ui.tag{ content = issue.closed and _("since #{date}", { date = format.date(issue.closed.date) }) or _("#{time_left} left", { time_left = issue.state_time_left }) }
|
bsw@216
|
122 end }
|
bsw@211
|
123 end }
|
bsw@211
|
124
|
bsw@216
|
125 ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Initiatives" } end }
|
bsw@215
|
126 ui.box_row{ class = "initiatives last", content = function()
|
bsw@217
|
127 ui.box_col{ id = "resizable", class = "scrolled", content = function()
|
bsw@215
|
128 execute.view{ module = "lf2", view = "_issue_initiatives", params = { initiatives = alternative_initiatives, current_initiative_id = initiative_id } }
|
bsw@215
|
129 end }
|
bsw@215
|
130 end }
|
bsw@215
|
131
|
bsw@217
|
132 ui.script{ script = "$(function() { $( '#resizable' ).resizable(); });" }
|
bsw@215
|
133
|
bsw@211
|
134 end }
|