liquid_feedback_frontend

annotate app/main/lf2/_initiative.lua @ 217:73dbc9e2bfd4

Cummulative patch for enhancements at next generation frontend
author bsw
date Sat Mar 12 19:22:50 2011 +0100 (2011-03-12)
parents 4f6e6b213fb8
children
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 ui.link{
bsw@211 49 module = "lf2", view = "initiative", id = initiative.id,
bsw@215 50 attr = { class = "name" },
bsw@211 51 text = initiative.name
bsw@211 52 }
bsw@211 53
bsw@211 54 ui.container{ attr = { class = "authors" }, content = function()
bsw@211 55 local members = initiative.initiating_members
bsw@211 56 slot.put(_"by", " ")
bsw@211 57 for i, member in ipairs(members) do
bsw@211 58 if i > 1 and i < #members then
bsw@211 59 slot.put(", ")
bsw@211 60 elseif i > 1 then
bsw@211 61 slot.put(" ", _"and", " ")
bsw@211 62 end
bsw@211 63 ui.link{
bsw@216 64 module = "lf2", view = "interest", params = {
bsw@216 65 issue_id = initiative.issue_id,
bsw@216 66 member_id = member.id
bsw@216 67 }, content = function()
bsw@211 68 ui.tag{ content = member.name }
bsw@211 69 end
bsw@211 70 }
bsw@211 71 end
bsw@211 72 end }
bsw@211 73
bsw@211 74

Impressum / About Us