liquid_feedback_frontend

view app/main/member/_show_thumb.lua @ 591:ce8cba9d88bb

No need to show an admin icon im member thumbnail
author bsw
date Fri Jun 22 16:31:07 2012 +0200 (2012-06-22)
parents 5ca9de94cb13
children c4b878748205
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 name
9 if member.name_highlighted then
10 name = encode.highlight(member.name_highlighted)
11 else
12 name = encode.html(member.name)
13 end
15 local container_class = "member_thumb"
16 if initiator and member.accepted ~= true then
17 container_class = container_class .. " not_accepted"
18 end
20 if member.is_informed == false then
21 container_class = container_class .. " not_informed"
22 end
24 local in_delegation_chain = false
25 if member.delegate_member_ids then
26 for member_id in member.delegate_member_ids:gmatch("(%w+)") do
27 if tonumber(member_id) == member.id then
28 in_delegation_chain = true
29 end
30 end
31 end
33 if in_delegation_chain or ((issue or initiative) and member.id == app.session.member_id) then
34 container_class = container_class .. " in_delegation_chain"
35 end
37 ui.container{
38 attr = { class = container_class },
39 content = function()
40 ui.container{
41 attr = { class = "flags" },
42 content = function()
44 if not member.active then
45 local text = _"inactive"
46 ui.tag{ content = text }
47 ui.image{
48 attr = { alt = text, title = text },
49 static = "icons/16/cross.png"
50 }
51 end
53 if member.grade then
54 ui.link{
55 module = "vote",
56 view = "list",
57 params = {
58 issue_id = initiative.issue.id,
59 member_id = member.id,
60 },
61 content = function()
62 if member.grade > 0 then
63 ui.image{
64 attr = {
65 alt = _"Voted yes",
66 title = _"Voted yes"
67 },
68 static = "icons/16/thumb_up_green.png"
69 }
70 elseif member.grade < 0 then
71 ui.image{
72 attr = {
73 alt = _"Voted no",
74 title = _"Voted no"
75 },
76 static = "icons/16/thumb_down_red.png"
77 }
78 else
79 ui.image{
80 attr = {
81 alt = _"Abstention",
82 title = _"Abstention"
83 },
84 static = "icons/16/bullet_yellow.png"
85 }
86 end
87 end
88 }
89 end
91 local weight = 0
92 if member.weight then
93 weight = member.weight
94 end
95 if member.voter_weight then
96 weight = member.voter_weight
97 end
98 if (issue or initiative) and weight > 1 then
99 local module
100 if issue then
101 module = "interest"
102 elseif initiative then
103 if member.voter_weight then
104 module = "vote"
105 else
106 module = "supporter"
107 end
108 end
109 ui.link{
110 attr = {
111 class = in_delegation_chain and "in_delegation_chain" or nil,
112 title = _"Number of incoming delegations, follow link to see more details"
113 },
114 content = _("+ #{weight}", { weight = weight - 1 }),
115 module = module,
116 view = "show_incoming",
117 params = {
118 member_id = member.id,
119 initiative_id = initiative and initiative.id or nil,
120 issue_id = issue and issue.id or nil
121 }
122 }
123 end
125 if initiator and initiator.accepted then
126 if member.accepted == nil then
127 slot.put(_"Invited")
128 elseif member.accepted == false then
129 slot.put(_"Rejected")
130 end
131 end
133 if member.is_informed == false then
134 local text = _"Member has not approved latest draft"
135 ui.image{
136 attr = { alt = text, title = text },
137 static = "icons/16/help_yellow.png"
138 }
139 end
141 -- TODO performance
142 if app.session.member_id then
143 local contact = Contact:by_pk(app.session.member.id, member.id)
144 if contact then
145 ui.image{
146 attr = {
147 alt = _"You have saved this member as contact",
148 title = _"You have saved this member as contact"
149 },
150 static = "icons/16/bullet_disk.png"
151 }
152 end
153 end
154 end
155 }
157 ui.link{
158 attr = { title = _"Show member" },
159 module = "member",
160 view = "show",
161 id = member.id,
162 content = function()
163 execute.view{
164 module = "member_image",
165 view = "_show",
166 params = {
167 member = member,
168 image_type = "avatar",
169 show_dummy = true
170 }
171 }
172 ui.container{
173 attr = { class = "member_name" },
174 content = name
175 }
176 end
177 }
178 end
179 }

Impressum / About Us