rev |
line source |
bsw@526
|
1 if not app.session.member_id then
|
bsw@526
|
2 return
|
bsw@526
|
3 end
|
bsw@526
|
4
|
bsw@525
|
5 local unit = param.get("unit", "table")
|
bsw@525
|
6 local area = param.get("area", "table")
|
bsw@525
|
7 local issue = param.get("issue", "table")
|
bsw@525
|
8
|
bsw@525
|
9 local unit_id = unit and unit.id or nil
|
bsw@525
|
10 local area_id = area and area.id or nil
|
bsw@525
|
11 local issue_id = issue and issue.id or nil
|
bsw@525
|
12
|
bsw@525
|
13 local info
|
bsw@525
|
14 local delegation_text
|
bsw@525
|
15
|
bsw@525
|
16 if unit then
|
bsw@525
|
17 info = unit.delegation_info
|
bsw@525
|
18 delegation_text = _"Delegate unit"
|
bsw@525
|
19 end
|
bsw@525
|
20
|
bsw@525
|
21 if area then
|
bsw@525
|
22 area:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw@525
|
23 info = area.delegation_info
|
bsw@525
|
24 delegation_text = _"Delegate area"
|
bsw@525
|
25 end
|
bsw@525
|
26
|
bsw@525
|
27 if issue then
|
bsw@525
|
28 issue:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw@525
|
29 info = issue.delegation_info
|
bsw@525
|
30 delegation_text = _"Delegate issue"
|
bsw@525
|
31 end
|
bsw@525
|
32
|
bsw@529
|
33 if info.own_participation or info.first_trustee_id then
|
bsw@525
|
34
|
bsw@529
|
35 ui.link{
|
bsw@529
|
36 module = "delegation", view = "show", params = {
|
bsw@529
|
37 unit_id = unit_id,
|
bsw@529
|
38 area_id = area_id,
|
bsw@529
|
39 issue_id = issue_id
|
bsw@529
|
40 },
|
bsw@529
|
41 attr = { class = "delegation_info" }, content = function()
|
bsw@525
|
42
|
bsw@525
|
43
|
bsw@529
|
44 local participant_occured = false
|
bsw@525
|
45
|
bsw@529
|
46 if info.own_participation or info.first_trustee_id then
|
bsw@529
|
47
|
bsw@525
|
48 local class = "micro_avatar"
|
bsw@529
|
49 if info.own_participation then
|
bsw@525
|
50 participant_occured = true
|
bsw@525
|
51 class = class .. " highlighted"
|
bsw@525
|
52 end
|
bsw@525
|
53
|
bsw@525
|
54 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@529
|
55 member = app.session.member, class = class, popup_text = app.session.member.name,
|
bsw@525
|
56 image_type = "avatar", show_dummy = true,
|
bsw@525
|
57 } }
|
bsw@525
|
58
|
bsw@525
|
59 end
|
bsw@525
|
60
|
bsw@529
|
61 if not (issue and issue.state == "voting" and info.own_participation) then
|
bsw@529
|
62
|
bsw@529
|
63 if info.first_trustee_id then
|
bsw@529
|
64
|
bsw@529
|
65 local text = _"delegates to"
|
bsw@529
|
66 ui.image{
|
bsw@529
|
67 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
68 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
69 }
|
bsw@525
|
70
|
bsw@529
|
71 local class = "micro_avatar"
|
bsw@529
|
72 if not participant_occured and info.first_trustee_participation then
|
bsw@529
|
73 participant_occured = true
|
bsw@529
|
74 class = class .. " highlighted"
|
bsw@529
|
75 end
|
bsw@529
|
76
|
bsw@529
|
77 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@529
|
78 member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
|
bsw@529
|
79 image_type = "avatar", show_dummy = true,
|
bsw@529
|
80 } }
|
bsw@529
|
81
|
bsw@529
|
82 end
|
bsw@529
|
83
|
bsw@529
|
84 if info.first_trustee_ellipsis then
|
bsw@529
|
85
|
bsw@529
|
86 local text = _"delegates to"
|
bsw@529
|
87 ui.image{
|
bsw@529
|
88 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
89 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
90 }
|
bsw@529
|
91
|
bsw@529
|
92 slot.put("...")
|
bsw@529
|
93
|
bsw@529
|
94 end
|
bsw@525
|
95
|
bsw@529
|
96 if info.other_trustee_id then
|
bsw@529
|
97
|
bsw@529
|
98 local text = _"delegates to"
|
bsw@529
|
99 ui.image{
|
bsw@529
|
100 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
101 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
102 }
|
bsw@525
|
103
|
bsw@529
|
104 local class = "micro_avatar"
|
bsw@529
|
105 if not participant_occured and info.other_trustee_participation then
|
bsw@529
|
106 participant_occured = true
|
bsw@529
|
107 class = class .. " highlighted"
|
bsw@529
|
108 end
|
bsw@529
|
109
|
bsw@529
|
110 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@529
|
111 member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
|
bsw@529
|
112 image_type = "avatar", show_dummy = true,
|
bsw@529
|
113 } }
|
bsw@525
|
114
|
bsw@529
|
115 end
|
bsw@529
|
116
|
bsw@529
|
117 if info.other_trustee_ellipsis then
|
bsw@529
|
118
|
bsw@529
|
119 local text = _"delegates to"
|
bsw@529
|
120 ui.image{
|
bsw@529
|
121 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
122 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
123 }
|
bsw@525
|
124
|
bsw@529
|
125 slot.put("...")
|
bsw@529
|
126
|
bsw@529
|
127 end
|
bsw@529
|
128
|
bsw@529
|
129 local trailing_ellipsis = info.other_trustee_ellipsis or
|
bsw@529
|
130 (info.first_trustee_ellipsis and not info.other_trustee_id)
|
bsw@529
|
131
|
bsw@529
|
132 if info.delegation_loop == "own" then
|
bsw@529
|
133
|
bsw@525
|
134 local text = _"delegates to"
|
bsw@525
|
135 ui.image{
|
bsw@525
|
136 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@525
|
137 static = "delegation_arrow_24_horizontal.png"
|
bsw@525
|
138 }
|
bsw@525
|
139
|
bsw@525
|
140 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@529
|
141 member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
|
bsw@525
|
142 image_type = "avatar", show_dummy = true,
|
bsw@525
|
143 } }
|
bsw@529
|
144
|
bsw@529
|
145 elseif info.delegation_loop == "first" then
|
bsw@529
|
146 if info.first_trustee_ellipsis then
|
bsw@529
|
147 if not trailing_ellipsis then
|
bsw@529
|
148
|
bsw@529
|
149 local text = _"delegates to"
|
bsw@529
|
150 ui.image{
|
bsw@529
|
151 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
152 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
153 }
|
bsw@529
|
154
|
bsw@529
|
155 slot.put("...")
|
bsw@529
|
156 end
|
bsw@529
|
157
|
bsw@529
|
158 else
|
bsw@529
|
159
|
bsw@529
|
160 local text = _"delegates to"
|
bsw@529
|
161 ui.image{
|
bsw@529
|
162 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
163 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
164 }
|
bsw@529
|
165
|
bsw@529
|
166 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@529
|
167 member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
|
bsw@529
|
168 image_type = "avatar", show_dummy = true,
|
bsw@529
|
169 } }
|
bsw@529
|
170 end
|
bsw@529
|
171
|
bsw@529
|
172
|
bsw@529
|
173 elseif info.delegation_loop and not trailing_ellipsis then
|
bsw@529
|
174 local text = _"delegates to"
|
bsw@529
|
175 ui.image{
|
bsw@529
|
176 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@529
|
177 static = "delegation_arrow_24_horizontal.png"
|
bsw@529
|
178 }
|
bsw@529
|
179
|
bsw@529
|
180 slot.put("...")
|
bsw@525
|
181 end
|
bsw@525
|
182
|
bsw@525
|
183 end
|
bsw@525
|
184
|
bsw@525
|
185 end
|
bsw@529
|
186
|
bsw@529
|
187 }
|
bsw@525
|
188
|
bsw@529
|
189 end |