liquid_feedback_frontend

view app/main/lf2/_initiative.lua @ 217:73dbc9e2bfd4

Cummulative patch for enhancements at next generation frontend
author bsw
date Sat Mar 12 19:22:50 2011 +0100 (2011-03-12)
parents 4f6e6b213fb8
children
line source
1 local initiative = param.get("initiative", "table")
3 ui.container{ attr = { class = "bar" }, content = function()
4 if initiative.issue.fully_frozen and initiative.issue.closed then
5 if initiative.issue.ranks_available then
6 if initiative.negative_votes and initiative.positive_votes then
7 local max_value = initiative.issue.voter_count
8 ui.bargraph{
9 max_value = max_value,
10 width = 100,
11 bars = {
12 { color = "#0a0", value = initiative.positive_votes },
13 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
14 { color = "#a00", value = initiative.negative_votes },
15 }
16 }
17 else
18 slot.put(" ")
19 end
20 else
21 slot.put(_"Counting of votes")
22 end
23 elseif initiative.issue.population then
24 local max_value = initiative.issue.population
25 ui.bargraph{
26 max_value = max_value,
27 width = 100,
28 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
29 quorum_color = "#00F",
30 bars = {
31 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
32 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
33 { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
34 }
35 }
36 else
37 slot.put(" ")
38 end
39 end }
41 if initiative.issue.fully_frozen and not initiative.issue.closed then
42 if not initiative.admitted then
43 ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" }
44 slot.put(" ")
45 end
46 end
48 ui.link{
49 module = "lf2", view = "initiative", id = initiative.id,
50 attr = { class = "name" },
51 text = initiative.name
52 }
54 ui.container{ attr = { class = "authors" }, content = function()
55 local members = initiative.initiating_members
56 slot.put(_"by", " ")
57 for i, member in ipairs(members) do
58 if i > 1 and i < #members then
59 slot.put(", ")
60 elseif i > 1 then
61 slot.put(" ", _"and", " ")
62 end
63 ui.link{
64 module = "lf2", view = "interest", params = {
65 issue_id = initiative.issue_id,
66 member_id = member.id
67 }, content = function()
68 ui.tag{ content = member.name }
69 end
70 }
71 end
72 end }

Impressum / About Us