rev |
line source |
bsw@211
|
1 local issues = param.get("issues", "table")
|
bsw@211
|
2
|
bsw@211
|
3 for i, issue in ipairs(issues) do
|
bsw@211
|
4 local initiatives = issue.initiatives
|
bsw@211
|
5
|
bsw@211
|
6 local interested_members = issue.interested_members
|
bsw@211
|
7
|
bsw@211
|
8 -- prepare interest of current user
|
bsw@211
|
9 local interest = issue.interest
|
bsw@211
|
10
|
bsw@211
|
11 -- prepare trustees
|
bsw@211
|
12 local trustees = Member:new_selector()
|
bsw@211
|
13 :add_field("delegation_chain.*")
|
bsw@211
|
14 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, " .. tostring(issue.id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
|
bsw@211
|
15 :add_order_by("index")
|
bsw@211
|
16 :exec()
|
bsw@211
|
17
|
bsw@211
|
18 local global_delegation
|
bsw@211
|
19 local area_delegation
|
bsw@211
|
20 local issue_delegation
|
bsw@211
|
21
|
bsw@211
|
22 for i, delegation in ipairs(issue.outgoing_delegations) do
|
bsw@211
|
23 if delegation.scope == "global" then global_delegation = delegation
|
bsw@211
|
24 elseif delegation.scope == "area" then area_delegation = delegation
|
bsw@211
|
25 elseif delegation.scope == "issue" then issue_delegation = delegation
|
bsw@211
|
26 end
|
bsw@211
|
27 end
|
bsw@211
|
28
|
bsw@211
|
29 local delegation = issue_delegation or area_delegation or global_delegation
|
bsw@211
|
30
|
bsw@211
|
31 local delegating_interest = issue.delegating_interest
|
bsw@211
|
32
|
bsw@211
|
33 ui.box{ class = "issue", content = function()
|
bsw@211
|
34
|
bsw@211
|
35 ui.box_row{ class = "head", content = function()
|
bsw@211
|
36
|
bsw@211
|
37 ui.box_col{ class = "issue_id left", content = function()
|
bsw@211
|
38 ui.link{
|
bsw@211
|
39 module = "lf2", view = "issue", id = issue.id,
|
bsw@211
|
40 content = _("Issue ##{id}", { id = issue.id })
|
bsw@211
|
41 }
|
bsw@211
|
42 end }
|
bsw@211
|
43
|
bsw@211
|
44 ui.box_col{ class = "unit_name right", content = function()
|
bsw@211
|
45 ui.link{
|
bsw@211
|
46 module = "lf2", view = "unit", id = 1,
|
bsw@211
|
47 content = "Dummy unit name"
|
bsw@211
|
48 }
|
bsw@211
|
49 end }
|
bsw@211
|
50 ui.box_col{ class = "area_name right clearright", content = function()
|
bsw@211
|
51 ui.link{
|
bsw@211
|
52 module = "lf2", view = "area_name", id = issue.area_id,
|
bsw@211
|
53 content = issue.area.name
|
bsw@211
|
54 }
|
bsw@211
|
55 end }
|
bsw@211
|
56 ui.box_col{ class = "policy_name left clearleft first", content = function()
|
bsw@211
|
57 ui.link{
|
bsw@211
|
58 module = "lf2", view = "policy", id = issue.policy_id,
|
bsw@211
|
59 content = issue.policy.name
|
bsw@211
|
60 }
|
bsw@211
|
61 end }
|
bsw@211
|
62
|
bsw@211
|
63 end }
|
bsw@211
|
64
|
bsw@211
|
65 ui.box_row{ class = "head2", content = function()
|
bsw@211
|
66
|
bsw@211
|
67 ui.box_col{ class = "state_name left", content = function()
|
bsw@211
|
68 ui.tag{ content = issue.state_name }
|
bsw@211
|
69 slot.put(" · ")
|
bsw@211
|
70 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@211
|
71 end }
|
bsw@211
|
72 end }
|
bsw@211
|
73
|
bsw@211
|
74 if interest or delegation then
|
bsw@211
|
75 ui.box_row{ class = "head2", content = function()
|
bsw@211
|
76 ui.box_col{ class = "interest left", content = function()
|
bsw@211
|
77 if interest then
|
bsw@211
|
78 ui.image{ static = "lf2/icon_star.png" }
|
bsw@211
|
79 if issue.closed then
|
bsw@211
|
80 slot.put(" ", _"You were interested in this issue")
|
bsw@211
|
81 else
|
bsw@211
|
82 slot.put(" ", _"You are interested in this issue")
|
bsw@211
|
83 end
|
bsw@211
|
84 elseif delegating_interest then
|
bsw@211
|
85 ui.image{ static = "lf2/icon_delegated_star.png" }
|
bsw@211
|
86 if issue.closed then
|
bsw@211
|
87 slot.put(" ", _"You were interested in this issue by delegation")
|
bsw@211
|
88 else
|
bsw@211
|
89 slot.put(" ", _"You are interested in this issue by delegation")
|
bsw@211
|
90 end
|
bsw@211
|
91 elseif trustees then
|
bsw@211
|
92 slot.put(_"You have delegated this issue")
|
bsw@211
|
93 else
|
bsw@211
|
94 slot.put(_"You are not interested in this issue")
|
bsw@211
|
95 end
|
bsw@211
|
96 end }
|
bsw@211
|
97 -- TODO if delegation ist falsch
|
bsw@211
|
98 if delegation then
|
bsw@211
|
99 slot.put(tostring(delegation.id))
|
bsw@211
|
100 ui.box_col{ class = "delegation right", content = function()
|
bsw@211
|
101 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
|
bsw@211
|
102 end }
|
bsw@211
|
103 end
|
bsw@211
|
104 end }
|
bsw@211
|
105 end
|
bsw@211
|
106
|
bsw@211
|
107 for i, initiative in ipairs(issue.initiatives) do
|
bsw@211
|
108 ui.box_row{ class = "initiative", content = function() ui.box_col { content = function()
|
bsw@211
|
109 execute.view{ module = "lf2", view = "_initiative", params = { initiative = initiative } }
|
bsw@211
|
110 end } end }
|
bsw@211
|
111 end
|
bsw@211
|
112
|
bsw@211
|
113 end }
|
bsw@211
|
114 end |