liquid_feedback_frontend

view app/main/initiative/_show_voting.lua @ 24:81586ea68d57

Minor bugfixes

app/main/initiative/_list.lua:
Replaced single by optional object mode

locale/translations.de.lua:
Consistent translation

app/main/initiative/_show.lua:
Added missing case "not approved" in voting info box

app/main/initiative/_show_voting.lua:
Added link to initiative

app/main/initiative/_show_voting.lua:
Added missing argument for link

app/main/member/show_tab.lua:
Added outgoing argument to show outgoing delegations correctly
author bsw
date Sun Feb 21 14:09:11 2010 +0100 (2010-02-21)
parents 00d1004545f1
children a6caaff47205
line source
1 local initiative = param.get("initiative", "table")
4 local battled_initiatives = Initiative:new_selector()
5 :add_field("winning_battle.count", "winning_count")
6 :add_field("losing_battle.count", "losing_count")
7 :join("battle", "winning_battle", { "winning_battle.winning_initiative_id = ? AND winning_battle.losing_initiative_id = initiative.id", initiative.id })
8 :join("battle", "losing_battle", { "losing_battle.losing_initiative_id = ? AND losing_battle.winning_initiative_id = initiative.id", initiative.id })
9 :add_order_by("rank")
10 :exec()
12 local number_of_initiatives = Initiative:new_selector()
13 :add_where{ "issue_id = ?", initiative.issue_id }
14 :add_where("admitted")
15 :count()
17 if initiative.revoked then
18 slot.put(_"Not voted (revoked from initiator)")
19 elseif initiative.admitted == false then
20 slot.put(_"Not voted (not admitted)")
21 else
22 if number_of_initiatives > 1 then
23 ui.container{
24 attr = { class = "heading first" },
25 content = _"This initiative compared to alternative initiatives"
26 }
28 ui.list{
29 records = battled_initiatives,
30 columns = {
31 {
32 content = function()
33 slot.put(_"This initiative")
34 end
35 },
36 {
37 content = function(record)
38 local population = initiative.issue.voter_count
39 local value = record.winning_count
40 ui.bargraph{
41 class = "bargraph bargraph50",
42 max_value = population,
43 width = 50,
44 bars = {
45 { color = "#aaa", value = population - value },
46 { color = "#444", value = value },
47 }
48 }
49 end
50 },
51 {
52 content = function(record)
53 slot.put(record.winning_count)
54 end
55 },
56 {
57 content = function(record)
58 if record.winning_count == record.losing_count then
59 ui.image{ static = "icons/16/bullet_blue.png" }
60 elseif record.winning_count > record.losing_count then
61 ui.image{ static = "icons/16/resultset_previous.png" }
62 else
63 ui.image{ static = "icons/16/resultset_next.png" }
64 end
65 end
66 },
67 {
68 field_attr = { style = "text-align: right;" },
69 content = function(record)
70 slot.put(record.losing_count)
71 end
72 },
73 {
74 content = function(record)
75 local population = initiative.issue.voter_count
76 local value = record.losing_count
77 ui.bargraph{
78 class = "bargraph bargraph50",
79 max_value = population,
80 width = 50,
81 bars = {
82 { color = "#444", value = value },
83 { color = "#aaa", value = population - value },
84 }
85 }
86 end
87 },
88 {
89 content = function(record)
90 ui.link{
91 module = "initiative",
92 view = "show",
93 id = record.id,
94 text = record.name
95 }
96 end
97 }
98 }
99 }
100 end
102 ui.container{
103 attr = { class = "heading" },
104 content = _"Member voting"
105 }
107 execute.view{
108 module = "member",
109 view = "_list",
110 params = {
111 initiative = initiative,
112 members_selector = initiative.issue:get_reference_selector("direct_voters")
113 :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id })
114 :add_field("direct_voter.weight as voter_weight")
115 :add_field("coalesce(vote.grade, 0) as grade")
116 }
117 }
119 end

Impressum / About Us