liquid_feedback_frontend
view app/main/member/_show_thumb.lua @ 60:7bc629bc1c20
Optionally show configuration specific head over issues in public access mode
author | bsw |
---|---|
date | Thu Apr 22 16:00:49 2010 +0200 (2010-04-22) |
parents | 0849be391140 |
children | 733f65c0c0a0 |
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 ui.container{
25 attr = { class = container_class },
26 content = function()
27 ui.container{
28 attr = { class = "flags" },
29 content = function()
31 if member.grade then
32 ui.link{
33 module = "vote",
34 view = "list",
35 params = {
36 issue_id = initiative.issue.id,
37 member_id = member.id,
38 },
39 content = function()
40 if member.grade > 0 then
41 ui.image{
42 attr = {
43 alt = _"Voted yes",
44 title = _"Voted yes"
45 },
46 static = "icons/16/thumb_up_green.png"
47 }
48 elseif member.grade < 0 then
49 ui.image{
50 attr = {
51 alt = _"Voted no",
52 title = _"Voted no"
53 },
54 static = "icons/16/thumb_down_red.png"
55 }
56 else
57 ui.image{
58 attr = {
59 alt = _"Abstention",
60 title = _"Abstention"
61 },
62 static = "icons/16/bullet_yellow.png"
63 }
64 end
65 end
66 }
67 end
69 local weight = 0
70 if member.weight then
71 weight = member.weight
72 end
73 if member.voter_weight then
74 weight = member.voter_weight
75 end
76 if (issue or initiative) and weight > 1 then
77 local module
78 if issue then
79 module = "interest"
80 elseif initiative then
81 if member.voter_weight then
82 module = "vote"
83 else
84 module = "supporter"
85 end
86 end
87 ui.link{
88 attr = { title = _"Number of incoming delegations, follow link to see more details" },
89 content = _("+ #{weight}", { weight = weight - 1 }),
90 module = module,
91 view = "show_incoming",
92 params = {
93 member_id = member.id,
94 initiative_id = initiative and initiative.id or nil,
95 issue_id = issue and issue.id or nil
96 }
97 }
98 end
100 if initiator and initiator.accepted then
101 if member.accepted == nil then
102 slot.put(_"Invited")
103 elseif member.accepted == false then
104 slot.put(_"Rejected")
105 end
106 end
108 if member.is_informed == false then
109 local text = _"Member has not approved latest draft"
110 ui.image{
111 attr = { alt = text, title = text },
112 static = "icons/16/help_yellow.png"
113 }
114 end
116 if member.admin then
117 ui.image{
118 attr = {
119 alt = _"Member is administrator",
120 title = _"Member is administrator"
121 },
122 static = "icons/16/cog.png"
123 }
124 end
126 -- TODO performance
127 if app.session.member_id then
128 local contact = Contact:by_pk(app.session.member.id, member.id)
129 if contact then
130 ui.image{
131 attr = {
132 alt = _"You have saved this member as contact",
133 title = _"You have saved this member as contact"
134 },
135 static = "icons/16/bullet_disk.png"
136 }
137 end
138 end
139 end
140 }
142 ui.link{
143 attr = { title = _"Show member" },
144 module = "member",
145 view = "show",
146 id = member.id,
147 content = function()
148 execute.view{
149 module = "member_image",
150 view = "_show",
151 params = {
152 member = member,
153 image_type = "avatar",
154 show_dummy = true
155 }
156 }
157 ui.container{
158 attr = { class = "member_name" },
159 content = function()
160 slot.put(name)
161 end
162 }
163 end
164 }
165 end
166 }