liquid_feedback_frontend

diff app/main/lf2/_initiative.lua @ 211:4993b71b383f

First checkin of lf2 (frontend second generation) prototype
author bsw
date Wed Mar 02 20:06:26 2011 +0100 (2011-03-02)
parents
children 1dab81353eb1
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/lf2/_initiative.lua	Wed Mar 02 20:06:26 2011 +0100
     1.3 @@ -0,0 +1,95 @@
     1.4 +local initiative = param.get("initiative", "table")
     1.5 +
     1.6 +ui.container{ attr = { class = "bar" }, content = function()
     1.7 +  if initiative.issue.fully_frozen and initiative.issue.closed then
     1.8 +    if initiative.issue.ranks_available then 
     1.9 +      if initiative.negative_votes and initiative.positive_votes then
    1.10 +        local max_value = initiative.issue.voter_count
    1.11 +        ui.bargraph{
    1.12 +          max_value = max_value,
    1.13 +          width = 100,
    1.14 +          bars = {
    1.15 +            { color = "#0a0", value = initiative.positive_votes },
    1.16 +            { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
    1.17 +            { color = "#a00", value = initiative.negative_votes },
    1.18 +          }
    1.19 +        }
    1.20 +      else
    1.21 +        slot.put(" ")
    1.22 +      end
    1.23 +    else
    1.24 +      slot.put(_"Counting of votes")
    1.25 +    end
    1.26 +  elseif initiative.issue.population then
    1.27 +    local max_value = initiative.issue.population
    1.28 +    ui.bargraph{
    1.29 +      max_value = max_value,
    1.30 +      width = 100,
    1.31 +      quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
    1.32 +      quorum_color = "#00F",
    1.33 +      bars = {
    1.34 +        { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
    1.35 +        { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
    1.36 +        { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
    1.37 +      }
    1.38 +    }
    1.39 +  else
    1.40 +    slot.put(" ")
    1.41 +  end
    1.42 +end }
    1.43 +
    1.44 +if initiative.issue.fully_frozen and not initiative.issue.closed then
    1.45 +  if not initiative.admitted then
    1.46 +    ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" }
    1.47 +    slot.put(" ")
    1.48 +  end
    1.49 +end
    1.50 +
    1.51 +if initiative.issue.closed then
    1.52 +  if initiative.issue.accepted then
    1.53 +    if initiative.admitted then
    1.54 +      if initiative.agreed then
    1.55 +        if initiative.rank == 1 then
    1.56 +          ui.image{ static = "lf2/icon_award_gold.png" }
    1.57 +        else
    1.58 +          ui.image{ static = "lf2/icon_award_silver.png" }
    1.59 +        end
    1.60 +        slot.put(" ")
    1.61 +        ui.tag{ content = initiative.rank }
    1.62 +      else
    1.63 +      ui.image{ attr = { title = _"Initiative not agreed" }, static = "lf2/icon_cross.png" }
    1.64 +      end
    1.65 +    else
    1.66 +      ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" }
    1.67 +    end
    1.68 +  else
    1.69 +   ui.image{ attr = { title = _"Issue not accepted" }, static = "lf2/icon_cross.png" }
    1.70 +  end
    1.71 +  slot.put(" ")
    1.72 +end
    1.73 +
    1.74 +ui.link{ 
    1.75 +  module = "lf2", view = "initiative", id = initiative.id,
    1.76 +  params = { tab = "draft" }, attr = { class = "name" }, 
    1.77 +  text = initiative.name
    1.78 +}
    1.79 +
    1.80 +ui.container{ attr = { class = "authors" }, content = function()
    1.81 +  local members = initiative.initiating_members
    1.82 +  slot.put(_"by", " ")
    1.83 +  for i, member in ipairs(members) do
    1.84 +    if i > 1 and i < #members then
    1.85 +      slot.put(", ")
    1.86 +    elseif i > 1 then
    1.87 +      slot.put(" ", _"and", " ")
    1.88 +    end
    1.89 +    ui.link{
    1.90 +      module = "lf2", view = "initiative", id = initiative.id,
    1.91 +      params = { member_id = member.id }, content = function()
    1.92 +        ui.tag{ content = member.name }
    1.93 +      end
    1.94 +    }
    1.95 +  end
    1.96 +end }
    1.97 +  
    1.98 +

Impressum / About Us