liquid_feedback_frontend

view app/main/initiative/_list_element.lua @ 862:a1ff5d08f0f4

Displays correct avatar when showing delegation chain preview for other member
author bsw
date Fri Aug 17 19:54:41 2012 +0200 (2012-08-17)
parents 21ae6ff8629a
children ae9ab3edff89
line source
1 local initiative = param.get("initiative", "table")
2 local selected = param.get("selected", atom.boolean)
3 local for_member = param.get("for_member", "table") or app.session.member
5 local class = "initiative"
7 if selected then
8 class = class .. " selected"
9 end
11 ui.container{ attr = { class = class }, content = function()
13 ui.container{ attr = { class = "rank" }, content = function()
14 if initiative.issue.accepted and initiative.issue.closed
15 and initiative.issue.ranks_available or initiative.admitted == false
16 then
17 ui.field.rank{ attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
18 elseif not initiative.issue.closed then
19 ui.image{ static = "icons/16/script.png" }
20 else
21 ui.image{ static = "icons/16/cross.png" }
22 end
23 end }
25 ui.container{ attr = { class = "bar" }, content = function()
26 if initiative.issue.fully_frozen and initiative.issue.closed then
27 if initiative.issue.ranks_available then
28 if initiative.negative_votes and initiative.positive_votes then
29 local max_value = initiative.issue.voter_count
30 ui.bargraph{
31 max_value = max_value,
32 width = 100,
33 bars = {
34 { color = "#0a5", value = initiative.positive_votes },
35 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
36 { color = "#a00", value = initiative.negative_votes },
37 }
38 }
39 else
40 slot.put(" ")
41 end
42 else
43 slot.put(_"Counting of votes")
44 end
45 else
46 local max_value = initiative.issue.population or 0
47 local quorum
48 if initiative.issue.accepted then
49 quorum = initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den
50 else
51 quorum = initiative.issue.policy.issue_quorum_num / initiative.issue.policy.issue_quorum_den
52 end
53 ui.bargraph{
54 max_value = max_value,
55 width = 100,
56 quorum = max_value * quorum,
57 quorum_color = "#00F",
58 bars = {
59 { color = "#0a5", value = (initiative.satisfied_supporter_count or 0) },
60 { color = "#aaa", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
61 { color = "#fff", value = max_value - (initiative.supporter_count or 0) },
62 }
63 }
64 end
65 end }
67 if app.session.member_id then
68 ui.container{ attr = { class = "interest" }, content = function()
69 if initiative.member_info.initiated then
70 local label
71 if for_member and for_member.id ~= app.session.member_id then
72 label = _"This member is initiator of this initiative"
73 else
74 label = _"You are initiator of this initiative"
75 end
76 ui.image{
77 attr = { alt = label, title = label },
78 static = "icons/16/user_edit.png"
79 }
80 elseif initiative.member_info.directly_supported then
81 if initiative.member_info.satisfied then
82 if for_member and for_member.id ~= app.session.member_id then
83 label = _"This member is supporter of this initiative"
84 else
85 local label = _"You are supporter of this initiative"
86 end
87 ui.image{
88 attr = { alt = label, title = label },
89 static = "icons/16/thumb_up_green.png"
90 }
91 else
92 if for_member and for_member.id ~= app.session.member_id then
93 label = _"This member is potential supporter of this initiative"
94 else
95 local label = _"You are potential supporter of this initiative"
96 end
97 ui.image{
98 attr = { alt = label, title = label },
99 static = "icons/16/thumb_up.png"
100 }
101 end
102 elseif initiative.member_info.supported then
103 if initiative.member_info.satisfied then
104 if for_member and for_member.id ~= app.session.member_id then
105 label = _"This member is supporter of this initiative via delegation"
106 else
107 local label = _"You are supporter of this initiative via delegation"
108 end
109 ui.image{
110 attr = { alt = label, title = label },
111 static = "icons/16/thumb_up_green_arrow.png"
112 }
113 else
114 if for_member and for_member.id ~= app.session.member_id then
115 label = _"This member is potential supporter of this initiative via delegation"
116 else
117 local label = _"You are potential supporter of this initiative via delegation"
118 end
119 ui.image{
120 attr = { alt = label, title = label },
121 static = "icons/16/thumb_up_arrow.png"
122 }
123 end
124 end
125 end }
126 end
128 ui.container{ attr = { class = "name" }, content = function()
129 local link_class = "initiative_link"
130 if initiative.revoked then
131 link_class = "revoked"
132 end
133 ui.link{
134 attr = { class = link_class },
135 content = function()
136 local name
137 if initiative.name_highlighted then
138 name = encode.highlight(initiative.name_highlighted)
139 else
140 name = encode.html(initiative.shortened_name)
141 end
142 ui.tag{ content = "i" .. initiative.id .. ": " }
143 slot.put(name)
144 end,
145 module = "initiative",
146 view = "show",
147 id = initiative.id
148 }
150 end }
152 end }

Impressum / About Us