liquid_feedback_frontend

view app/main/lf2/_initiative.lua @ 211:4993b71b383f

First checkin of lf2 (frontend second generation) prototype
author bsw
date Wed Mar 02 20:06:26 2011 +0100 (2011-03-02)
parents
children 1dab81353eb1
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 if initiative.issue.closed then
49 if initiative.issue.accepted then
50 if initiative.admitted then
51 if initiative.agreed then
52 if initiative.rank == 1 then
53 ui.image{ static = "lf2/icon_award_gold.png" }
54 else
55 ui.image{ static = "lf2/icon_award_silver.png" }
56 end
57 slot.put(" ")
58 ui.tag{ content = initiative.rank }
59 else
60 ui.image{ attr = { title = _"Initiative not agreed" }, static = "lf2/icon_cross.png" }
61 end
62 else
63 ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" }
64 end
65 else
66 ui.image{ attr = { title = _"Issue not accepted" }, static = "lf2/icon_cross.png" }
67 end
68 slot.put(" ")
69 end
71 ui.link{
72 module = "lf2", view = "initiative", id = initiative.id,
73 params = { tab = "draft" }, attr = { class = "name" },
74 text = initiative.name
75 }
77 ui.container{ attr = { class = "authors" }, content = function()
78 local members = initiative.initiating_members
79 slot.put(_"by", " ")
80 for i, member in ipairs(members) do
81 if i > 1 and i < #members then
82 slot.put(", ")
83 elseif i > 1 then
84 slot.put(" ", _"and", " ")
85 end
86 ui.link{
87 module = "lf2", view = "initiative", id = initiative.id,
88 params = { member_id = member.id }, content = function()
89 ui.tag{ content = member.name }
90 end
91 }
92 end
93 end }

Impressum / About Us