liquid_feedback_frontend

view app/main/member/_show_thumb.lua @ 580:878081c51189

Removed greek again for the present
author bsw
date Wed Jun 20 13:30:47 2012 +0200 (2012-06-20)
parents 5ca9de94cb13
children ce8cba9d88bb
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 if member.admin then
142 ui.image{
143 attr = {
144 alt = _"Member is administrator",
145 title = _"Member is administrator"
146 },
147 static = "icons/16/cog.png"
148 }
149 end
151 -- TODO performance
152 if app.session.member_id then
153 local contact = Contact:by_pk(app.session.member.id, member.id)
154 if contact then
155 ui.image{
156 attr = {
157 alt = _"You have saved this member as contact",
158 title = _"You have saved this member as contact"
159 },
160 static = "icons/16/bullet_disk.png"
161 }
162 end
163 end
164 end
165 }
167 ui.link{
168 attr = { title = _"Show member" },
169 module = "member",
170 view = "show",
171 id = member.id,
172 content = function()
173 execute.view{
174 module = "member_image",
175 view = "_show",
176 params = {
177 member = member,
178 image_type = "avatar",
179 show_dummy = true
180 }
181 }
182 ui.container{
183 attr = { class = "member_name" },
184 content = name
185 }
186 end
187 }
188 end
189 }

Impressum / About Us