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