liquid_feedback_frontend

view app/main/member/_show_thumb.lua @ 126:36aedac3e4bf

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

Impressum / About Us