liquid_feedback_frontend

diff app/main/initiative/_show_voting.lua @ 31:a6caaff47205

Report view for all closed issues added
author bsw
date Tue Feb 23 21:09:10 2010 +0100 (2010-02-23)
parents 81586ea68d57
children 256d9be75916
line diff
     1.1 --- a/app/main/initiative/_show_voting.lua	Sun Feb 21 17:34:37 2010 +0100
     1.2 +++ b/app/main/initiative/_show_voting.lua	Tue Feb 23 21:09:10 2010 +0100
     1.3 @@ -1,103 +1,16 @@
     1.4  local initiative = param.get("initiative", "table")
     1.5  
     1.6 -
     1.7 -local battled_initiatives = Initiative:new_selector()
     1.8 -  :add_field("winning_battle.count", "winning_count")
     1.9 -  :add_field("losing_battle.count", "losing_count")
    1.10 -  :join("battle", "winning_battle", { "winning_battle.winning_initiative_id = ? AND winning_battle.losing_initiative_id = initiative.id", initiative.id })
    1.11 -  :join("battle", "losing_battle", { "losing_battle.losing_initiative_id = ? AND losing_battle.winning_initiative_id = initiative.id", initiative.id })
    1.12 -  :add_order_by("rank")
    1.13 -  :exec()
    1.14 -
    1.15 -local number_of_initiatives = Initiative:new_selector()
    1.16 -  :add_where{ "issue_id = ?", initiative.issue_id }
    1.17 -  :add_where("admitted")
    1.18 -  :count()
    1.19 -
    1.20  if initiative.revoked then
    1.21    slot.put(_"Not voted (revoked from initiator)")
    1.22  elseif initiative.admitted == false then
    1.23    slot.put(_"Not voted (not admitted)")
    1.24  else
    1.25 -  if number_of_initiatives > 1 then
    1.26 -    ui.container{
    1.27 -      attr = { class = "heading first" },
    1.28 -      content = _"This initiative compared to alternative initiatives"
    1.29 -    }
    1.30  
    1.31 -    ui.list{
    1.32 -      records = battled_initiatives,
    1.33 -      columns = {
    1.34 -        {
    1.35 -          content = function()
    1.36 -            slot.put(_"This initiative")
    1.37 -          end
    1.38 -        },
    1.39 -        {
    1.40 -          content = function(record)
    1.41 -            local population = initiative.issue.voter_count
    1.42 -            local value = record.winning_count
    1.43 -            ui.bargraph{
    1.44 -              class = "bargraph bargraph50",
    1.45 -              max_value = population,
    1.46 -              width = 50,
    1.47 -              bars = {
    1.48 -                { color = "#aaa", value = population - value },
    1.49 -                { color = "#444", value = value },
    1.50 -              }
    1.51 -            }
    1.52 -          end
    1.53 -        },
    1.54 -        {
    1.55 -          content = function(record)
    1.56 -            slot.put(record.winning_count)
    1.57 -          end
    1.58 -        },
    1.59 -        {
    1.60 -          content = function(record)
    1.61 -            if record.winning_count == record.losing_count then
    1.62 -              ui.image{ static = "icons/16/bullet_blue.png" }
    1.63 -            elseif record.winning_count > record.losing_count then
    1.64 -              ui.image{ static = "icons/16/resultset_previous.png" }
    1.65 -            else
    1.66 -              ui.image{ static = "icons/16/resultset_next.png" }
    1.67 -            end
    1.68 -          end
    1.69 -        },
    1.70 -        {
    1.71 -          field_attr = { style = "text-align: right;" },
    1.72 -          content = function(record)
    1.73 -            slot.put(record.losing_count)
    1.74 -          end
    1.75 -        },
    1.76 -        {
    1.77 -          content = function(record)
    1.78 -            local population = initiative.issue.voter_count
    1.79 -            local value = record.losing_count
    1.80 -            ui.bargraph{
    1.81 -              class = "bargraph bargraph50",
    1.82 -              max_value = population,
    1.83 -              width = 50,
    1.84 -              bars = {
    1.85 -                { color = "#444", value = value },
    1.86 -                { color = "#aaa", value = population - value },
    1.87 -              }
    1.88 -            }
    1.89 -          end
    1.90 -        },
    1.91 -        {
    1.92 -          content = function(record)
    1.93 -            ui.link{
    1.94 -              module = "initiative",
    1.95 -              view = "show",
    1.96 -              id = record.id,
    1.97 -              text = record.name
    1.98 -            }
    1.99 -          end
   1.100 -        }
   1.101 -      }
   1.102 -    }
   1.103 -  end
   1.104 +  execute.view{
   1.105 +    module = "initiative",
   1.106 +    view = "_battles",
   1.107 +    params = { initiative = initiative }
   1.108 +  }
   1.109  
   1.110    ui.container{
   1.111      attr = { class = "heading" },

Impressum / About Us