liquid_feedback_frontend

view app/main/delegation/_info.lua @ 780:9d4398195faf

Removed link from delegation infos for other members
author bsw
date Fri Jun 29 00:06:43 2012 +0200 (2012-06-29)
parents a3eb6ca34484
children 701a5cf6b067
line source
1 if not app.session.member_id then
2 return
3 end
5 local member = param.get("member", "table") or app.session.member
7 local unit = param.get("unit", "table")
8 local area = param.get("area", "table")
9 local issue = param.get("issue", "table")
11 local unit_id = unit and unit.id or nil
12 local area_id = area and area.id or nil
13 local issue_id = issue and issue.id or nil
15 local info
16 local delegation_text
18 if unit then
19 info = unit.delegation_info
20 delegation_text = _"Delegate unit"
21 end
23 if area then
24 area:load_delegation_info_once_for_member_id(member.id)
25 info = area.delegation_info
26 delegation_text = _"Delegate area"
27 end
29 if issue then
30 info = issue.member_info
31 delegation_text = _"Delegate issue"
32 end
34 local function print_delegation_info()
35 local participant_occured = false
37 if info.own_participation or info.first_trustee_id then
39 local class = "micro_avatar"
40 if info.own_participation then
41 participant_occured = true
42 class = class .. " highlighted"
43 end
45 execute.view{ module = "member_image", view = "_show", params = {
46 member = member, class = class, popup_text = member.name,
47 image_type = "avatar", show_dummy = true,
48 } }
50 end
52 if not (issue and issue.state == "voting" and info.own_participation) then
54 if info.first_trustee_id then
56 local text = _"delegates to"
57 ui.image{
58 attr = { class = "delegation_arrow", alt = text, title = text },
59 static = "delegation_arrow_24_horizontal.png"
60 }
62 local class = "micro_avatar"
63 if not participant_occured and info.first_trustee_participation then
64 participant_occured = true
65 class = class .. " highlighted"
66 end
68 execute.view{ module = "member_image", view = "_show", params = {
69 member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
70 image_type = "avatar", show_dummy = true,
71 } }
73 end
75 if info.first_trustee_ellipsis then
77 local text = _"delegates to"
78 ui.image{
79 attr = { class = "delegation_arrow", alt = text, title = text },
80 static = "delegation_arrow_24_horizontal.png"
81 }
83 slot.put("...")
85 end
87 if info.other_trustee_id then
89 local text = _"delegates to"
90 ui.image{
91 attr = { class = "delegation_arrow", alt = text, title = text },
92 static = "delegation_arrow_24_horizontal.png"
93 }
95 local class = "micro_avatar"
96 if not participant_occured and info.other_trustee_participation then
97 participant_occured = true
98 class = class .. " highlighted"
99 end
101 execute.view{ module = "member_image", view = "_show", params = {
102 member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
103 image_type = "avatar", show_dummy = true,
104 } }
106 end
108 if info.other_trustee_ellipsis then
110 local text = _"delegates to"
111 ui.image{
112 attr = { class = "delegation_arrow", alt = text, title = text },
113 static = "delegation_arrow_24_horizontal.png"
114 }
116 slot.put("...")
118 end
120 local trailing_ellipsis = info.other_trustee_ellipsis or
121 (info.first_trustee_ellipsis and not info.other_trustee_id)
123 if info.delegation_loop == "own" then
125 local text = _"delegates to"
126 ui.image{
127 attr = { class = "delegation_arrow", alt = text, title = text },
128 static = "delegation_arrow_24_horizontal.png"
129 }
131 execute.view{ module = "member_image", view = "_show", params = {
132 member = member, class = "micro_avatar", popup_text = member.name,
133 image_type = "avatar", show_dummy = true,
134 } }
136 elseif info.delegation_loop == "first" then
137 if info.first_trustee_ellipsis then
138 if not trailing_ellipsis then
140 local text = _"delegates to"
141 ui.image{
142 attr = { class = "delegation_arrow", alt = text, title = text },
143 static = "delegation_arrow_24_horizontal.png"
144 }
146 slot.put("...")
147 end
149 else
151 local text = _"delegates to"
152 ui.image{
153 attr = { class = "delegation_arrow", alt = text, title = text },
154 static = "delegation_arrow_24_horizontal.png"
155 }
157 execute.view{ module = "member_image", view = "_show", params = {
158 member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
159 image_type = "avatar", show_dummy = true,
160 } }
161 end
164 elseif info.delegation_loop and not trailing_ellipsis then
165 local text = _"delegates to"
166 ui.image{
167 attr = { class = "delegation_arrow", alt = text, title = text },
168 static = "delegation_arrow_24_horizontal.png"
169 }
171 slot.put("...")
172 end
174 end
175 end
178 if info.own_participation or info.first_trustee_id then
179 if app.session.member_id == member.id then
180 ui.link{
181 module = "delegation", view = "show", params = {
182 unit_id = unit_id,
183 area_id = area_id,
184 issue_id = issue_id
185 },
186 attr = { class = "delegation_info" }, content = function()
187 print_delegation_info()
188 end
189 }
190 else
191 ui.container{
192 attr = { class = "delegation_info" }, content = function()
193 print_delegation_info()
194 end
195 }
196 end
197 end

Impressum / About Us