liquid_feedback_frontend

view app/main/member/_show_thumb.lua @ 1214:5c1e3b23170a

Fixed error when display profile page publically
author bsw
date Mon Jul 27 23:27:00 2015 +0200 (2015-07-27)
parents 701a5cf6b067
children 32cc544d5a5b
line source
1 local initiator = param.get("initiator", "table")
2 local member = param.get("member", "table")
4 local issue = param.get("issue", "table")
5 local initiative = param.get("initiative", "table")
6 local trustee = param.get("trustee", "table")
8 local class = param.get("class")
10 local name_html
11 if member.name_highlighted then
12 name_html = encode.highlight(member.name_highlighted)
13 else
14 name_html = encode.html(member.name)
15 end
17 local container_class = "member_thumb"
18 if initiator and member.accepted ~= true then
19 container_class = container_class .. " not_accepted"
20 end
22 if member.is_informed == false then
23 container_class = container_class .. " not_informed"
24 end
26 if class then
27 container_class = container_class .. " " .. class
28 end
30 local in_delegation_chain = member.in_delegation_chain
31 --[[if member.delegate_member_ids then
32 for member_id in member.delegate_member_ids:gmatch("(%w+)") do
33 if tonumber(member_id) == member.id then
34 in_delegation_chain = true
35 end
36 end
37 end
38 --]]
39 if in_delegation_chain or ((issue or initiative) and member.id == app.session.member_id) then
40 container_class = container_class .. " in_delegation_chain"
41 end
43 ui.container{
44 attr = { class = container_class },
45 content = function()
47 local function doit()
48 execute.view{
49 module = "member_image",
50 view = "_show",
51 params = {
52 member = member,
53 image_type = "avatar",
54 show_dummy = true
55 }
56 }
57 ui.tag{
58 attr = { class = "member_name" },
59 content = function() slot.put(name_html) end
60 }
61 end
63 if app.session:has_access("everything") then
64 ui.link{
65 attr = { title = _"Show member" },
66 module = "member",
67 view = "show",
68 id = member.id,
69 content = doit
70 }
71 else
72 ui.tag{ content = doit }
73 end
75 if member.grade then
76 slot.put ( " " )
77 ui.link{
78 module = "vote",
79 view = "list",
80 params = {
81 issue_id = initiative.issue.id,
82 member_id = member.id,
83 },
84 content = function()
85 if member.grade > 0 then
86 ui.image{
87 attr = {
88 alt = _"Voted yes",
89 title = _"Voted yes",
90 class = "icon24 right"
91 },
92 static = "icons/32/support_satisfied.png"
93 }
94 elseif member.grade < 0 then
95 ui.image{
96 attr = {
97 alt = _"Voted no",
98 title = _"Voted no",
99 class = "icon24 right"
100 },
101 static = "icons/32/voted_no.png"
102 }
103 else
104 ui.image{
105 attr = {
106 alt = _"Abstention",
107 title = _"Abstention",
108 class = "icon24 right"
109 },
110 static = "icons/16/bullet_yellow.png"
111 }
112 end
113 end
114 }
115 end
117 if (member.voter_comment) then
118 ui.link{
119 module = "vote",
120 view = "list",
121 params = {
122 issue_id = issue.id,
123 member_id = member.id,
124 },
125 content = function()
126 ui.image{
127 attr = {
128 alt = _"Voting comment available",
129 title = _"Voting comment available",
130 class = "icon24 right"
131 },
132 static = "icons/16/comment.png"
133 }
134 end
135 }
136 end
138 local weight = 0
139 if member.weight then
140 weight = member.weight
141 end
142 if member.voter_weight then
143 weight = member.voter_weight
144 end
146 if (issue or initiative) and weight > 1 then
147 local module = "interest"
148 if member.voter_weight then
149 module = "vote"
150 end
152 slot.put ( " " )
153 ui.link{
154 attr = {
155 class = in_delegation_chain and "in_delegation_chain" or nil,
156 title = _"Number of incoming delegations, follow link to see more details"
157 },
158 content = _("+ #{weight}", { weight = weight - 1 }),
159 module = module,
160 view = "show_incoming",
161 params = {
162 member_id = member.id,
163 initiative_id = initiative and initiative.id or nil,
164 issue_id = issue and issue.id or nil
165 }
166 }
167 end
169 if member.supporter then
170 slot.put ( " " )
171 if member.supporter_satisfied then
172 local text = _"supporter"
173 ui.image{ attr = { class = "icon24 right", alt = text, title = text }, static = "icons/32/support_satisfied.png" }
174 else
175 local text = _"supporter with restricting suggestions"
176 ui.image{ attr = { class = "icon24 right", alt = text, title = text }, static = "icons/32/support_unsatisfied.png" }
177 end
178 end
180 if not member.active then
181 slot.put ( " " )
182 local text = _"member inactive"
183 ui.image{
184 attr = { alt = text, title = text },
185 static = "icons/16/cross.png"
186 }
187 ui.tag{ content = _"inactive" }
188 end
190 if initiator and initiator.accepted then
191 if member.accepted == nil then
192 slot.put(_"Invited")
193 elseif member.accepted == false then
194 slot.put(_"Rejected")
195 end
196 end
198 if member.is_informed == false then
199 local text = _"Member has not approved latest draft"
200 ui.image{
201 attr = { alt = text, title = text },
202 static = "icons/16/help_yellow.png"
203 }
204 end
206 end
207 }

Impressum / About Us