| rev |
line source |
|
bsw@211
|
1 local initiative = param.get("initiative", "table")
|
|
bsw@211
|
2
|
|
bsw@211
|
3 ui.container{ attr = { class = "bar" }, content = function()
|
|
bsw@211
|
4 if initiative.issue.fully_frozen and initiative.issue.closed then
|
|
bsw@211
|
5 if initiative.issue.ranks_available then
|
|
bsw@211
|
6 if initiative.negative_votes and initiative.positive_votes then
|
|
bsw@211
|
7 local max_value = initiative.issue.voter_count
|
|
bsw@211
|
8 ui.bargraph{
|
|
bsw@211
|
9 max_value = max_value,
|
|
bsw@211
|
10 width = 100,
|
|
bsw@211
|
11 bars = {
|
|
bsw@211
|
12 { color = "#0a0", value = initiative.positive_votes },
|
|
bsw@211
|
13 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
|
|
bsw@211
|
14 { color = "#a00", value = initiative.negative_votes },
|
|
bsw@211
|
15 }
|
|
bsw@211
|
16 }
|
|
bsw@211
|
17 else
|
|
bsw@211
|
18 slot.put(" ")
|
|
bsw@211
|
19 end
|
|
bsw@211
|
20 else
|
|
bsw@211
|
21 slot.put(_"Counting of votes")
|
|
bsw@211
|
22 end
|
|
bsw@211
|
23 elseif initiative.issue.population then
|
|
bsw@211
|
24 local max_value = initiative.issue.population
|
|
bsw@211
|
25 ui.bargraph{
|
|
bsw@211
|
26 max_value = max_value,
|
|
bsw@211
|
27 width = 100,
|
|
bsw@211
|
28 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
|
|
bsw@211
|
29 quorum_color = "#00F",
|
|
bsw@211
|
30 bars = {
|
|
bsw@211
|
31 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
|
|
bsw@211
|
32 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
|
|
bsw@211
|
33 { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
|
|
bsw@211
|
34 }
|
|
bsw@211
|
35 }
|
|
bsw@211
|
36 else
|
|
bsw@211
|
37 slot.put(" ")
|
|
bsw@211
|
38 end
|
|
bsw@211
|
39 end }
|
|
bsw@211
|
40
|
|
bsw@211
|
41 if initiative.issue.fully_frozen and not initiative.issue.closed then
|
|
bsw@211
|
42 if not initiative.admitted then
|
|
bsw@211
|
43 ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" }
|
|
bsw@211
|
44 slot.put(" ")
|
|
bsw@211
|
45 end
|
|
bsw@211
|
46 end
|
|
bsw@211
|
47
|
|
bsw@211
|
48 if initiative.issue.closed then
|
|
bsw@211
|
49 if initiative.issue.accepted then
|
|
bsw@211
|
50 if initiative.admitted then
|
|
bsw@211
|
51 if initiative.agreed then
|
|
bsw@211
|
52 if initiative.rank == 1 then
|
|
bsw@211
|
53 ui.image{ static = "lf2/icon_award_gold.png" }
|
|
bsw@211
|
54 else
|
|
bsw@211
|
55 ui.image{ static = "lf2/icon_award_silver.png" }
|
|
bsw@211
|
56 end
|
|
bsw@211
|
57 slot.put(" ")
|
|
bsw@211
|
58 ui.tag{ content = initiative.rank }
|
|
bsw@211
|
59 else
|
|
bsw@211
|
60 ui.image{ attr = { title = _"Initiative not agreed" }, static = "lf2/icon_cross.png" }
|
|
bsw@211
|
61 end
|
|
bsw@211
|
62 else
|
|
bsw@211
|
63 ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" }
|
|
bsw@211
|
64 end
|
|
bsw@211
|
65 else
|
|
bsw@211
|
66 ui.image{ attr = { title = _"Issue not accepted" }, static = "lf2/icon_cross.png" }
|
|
bsw@211
|
67 end
|
|
bsw@211
|
68 slot.put(" ")
|
|
bsw@211
|
69 end
|
|
bsw@211
|
70
|
|
bsw@211
|
71 ui.link{
|
|
bsw@211
|
72 module = "lf2", view = "initiative", id = initiative.id,
|
|
bsw@211
|
73 params = { tab = "draft" }, attr = { class = "name" },
|
|
bsw@211
|
74 text = initiative.name
|
|
bsw@211
|
75 }
|
|
bsw@211
|
76
|
|
bsw@211
|
77 ui.container{ attr = { class = "authors" }, content = function()
|
|
bsw@211
|
78 local members = initiative.initiating_members
|
|
bsw@211
|
79 slot.put(_"by", " ")
|
|
bsw@211
|
80 for i, member in ipairs(members) do
|
|
bsw@211
|
81 if i > 1 and i < #members then
|
|
bsw@211
|
82 slot.put(", ")
|
|
bsw@211
|
83 elseif i > 1 then
|
|
bsw@211
|
84 slot.put(" ", _"and", " ")
|
|
bsw@211
|
85 end
|
|
bsw@211
|
86 ui.link{
|
|
bsw@211
|
87 module = "lf2", view = "initiative", id = initiative.id,
|
|
bsw@211
|
88 params = { member_id = member.id }, content = function()
|
|
bsw@211
|
89 ui.tag{ content = member.name }
|
|
bsw@211
|
90 end
|
|
bsw@211
|
91 }
|
|
bsw@211
|
92 end
|
|
bsw@211
|
93 end }
|
|
bsw@211
|
94
|
|
bsw@211
|
95
|