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