liquid_feedback_frontend

view app/main/lf2/_issue_initiatives.lua @ 218:7ea52c710503

Some little changes for next generation frontend
author bsw
date Sun Mar 13 16:53:33 2011 +0100 (2011-03-13)
parents 1dab81353eb1
children
line source
1 local initiatives = param.get("initiatives", "table")
2 local current_initiative_id = param.get("current_initiative_id", atom.integer)
4 for i, initiative in ipairs(initiatives) do
6 local class = "initiative"
7 if i == 1 then class = class .. " first" end
8 if initiative.id == current_initiative_id then class = class .. " active" end
10 ui.box_row{ class = class, content = function() ui.box_col { content = function()
12 ui.link{
13 module = "lf2", view = "initiative", id = initiative.id,
14 attr = { class = "name" },
15 text = initiative.name
16 }
18 ui.container{ attr = { class = "bar" }, content = function()
19 if initiative.issue.fully_frozen and initiative.issue.closed then
20 if initiative.issue.ranks_available then
21 if initiative.negative_votes and initiative.positive_votes then
22 local max_value = initiative.issue.voter_count
23 ui.bargraph{
24 max_value = max_value,
25 width = 100,
26 bars = {
27 { color = "#0a0", value = initiative.positive_votes },
28 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
29 { color = "#a00", value = initiative.negative_votes },
30 }
31 }
32 else
33 slot.put(" ")
34 end
35 else
36 slot.put(_"Counting of votes")
37 end
38 elseif initiative.issue.population then
39 local max_value = initiative.issue.population
40 ui.bargraph{
41 max_value = max_value,
42 width = 100,
43 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
44 quorum_color = "#00F",
45 bars = {
46 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
47 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
48 { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
49 }
50 }
51 else
52 slot.put(" ")
53 end
54 end }
56 ui.container{ attr = { class = "authors" }, content = function()
57 local members = initiative.initiating_members
58 slot.put(_"by", " ")
59 for i, member in ipairs(members) do
60 if i > 1 and i < #members then
61 slot.put(", ")
62 elseif i > 1 then
63 slot.put(" ", _"and", " ")
64 end
65 ui.link{
66 module = "lf2", view = "initiative", id = initiative.id,
67 params = { member_id = member.id }, text = member.name
68 }
69 end
70 end }
72 end } end }
74 end

Impressum / About Us