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