liquid_feedback_frontend

view app/main/delegation/_info.lua @ 774:a3eb6ca34484

Completed membership/privilege tab in member page
author bsw
date Thu Jun 28 23:57:02 2012 +0200 (2012-06-28)
parents c1dc3b14a4f3
children 9d4398195faf
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 if info.own_participation or info.first_trustee_id then
36 ui.link{
37 module = "delegation", view = "show", params = {
38 unit_id = unit_id,
39 area_id = area_id,
40 issue_id = issue_id
41 },
42 attr = { class = "delegation_info" }, content = function()
45 local participant_occured = false
47 if info.own_participation or info.first_trustee_id then
49 local class = "micro_avatar"
50 if info.own_participation then
51 participant_occured = true
52 class = class .. " highlighted"
53 end
55 execute.view{ module = "member_image", view = "_show", params = {
56 member = member, class = class, popup_text = member.name,
57 image_type = "avatar", show_dummy = true,
58 } }
60 end
62 if not (issue and issue.state == "voting" and info.own_participation) then
64 if info.first_trustee_id then
66 local text = _"delegates to"
67 ui.image{
68 attr = { class = "delegation_arrow", alt = text, title = text },
69 static = "delegation_arrow_24_horizontal.png"
70 }
72 local class = "micro_avatar"
73 if not participant_occured and info.first_trustee_participation then
74 participant_occured = true
75 class = class .. " highlighted"
76 end
78 execute.view{ module = "member_image", view = "_show", params = {
79 member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
80 image_type = "avatar", show_dummy = true,
81 } }
83 end
85 if info.first_trustee_ellipsis then
87 local text = _"delegates to"
88 ui.image{
89 attr = { class = "delegation_arrow", alt = text, title = text },
90 static = "delegation_arrow_24_horizontal.png"
91 }
93 slot.put("...")
95 end
97 if info.other_trustee_id then
99 local text = _"delegates to"
100 ui.image{
101 attr = { class = "delegation_arrow", alt = text, title = text },
102 static = "delegation_arrow_24_horizontal.png"
103 }
105 local class = "micro_avatar"
106 if not participant_occured and info.other_trustee_participation then
107 participant_occured = true
108 class = class .. " highlighted"
109 end
111 execute.view{ module = "member_image", view = "_show", params = {
112 member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
113 image_type = "avatar", show_dummy = true,
114 } }
116 end
118 if info.other_trustee_ellipsis then
120 local text = _"delegates to"
121 ui.image{
122 attr = { class = "delegation_arrow", alt = text, title = text },
123 static = "delegation_arrow_24_horizontal.png"
124 }
126 slot.put("...")
128 end
130 local trailing_ellipsis = info.other_trustee_ellipsis or
131 (info.first_trustee_ellipsis and not info.other_trustee_id)
133 if info.delegation_loop == "own" then
135 local text = _"delegates to"
136 ui.image{
137 attr = { class = "delegation_arrow", alt = text, title = text },
138 static = "delegation_arrow_24_horizontal.png"
139 }
141 execute.view{ module = "member_image", view = "_show", params = {
142 member = member, class = "micro_avatar", popup_text = member.name,
143 image_type = "avatar", show_dummy = true,
144 } }
146 elseif info.delegation_loop == "first" then
147 if info.first_trustee_ellipsis then
148 if not trailing_ellipsis then
150 local text = _"delegates to"
151 ui.image{
152 attr = { class = "delegation_arrow", alt = text, title = text },
153 static = "delegation_arrow_24_horizontal.png"
154 }
156 slot.put("...")
157 end
159 else
161 local text = _"delegates to"
162 ui.image{
163 attr = { class = "delegation_arrow", alt = text, title = text },
164 static = "delegation_arrow_24_horizontal.png"
165 }
167 execute.view{ module = "member_image", view = "_show", params = {
168 member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
169 image_type = "avatar", show_dummy = true,
170 } }
171 end
174 elseif info.delegation_loop and not trailing_ellipsis then
175 local text = _"delegates to"
176 ui.image{
177 attr = { class = "delegation_arrow", alt = text, title = text },
178 static = "delegation_arrow_24_horizontal.png"
179 }
181 slot.put("...")
182 end
184 end
186 end
188 }
190 end

Impressum / About Us