liquid_feedback_frontend

annotate app/main/initiative/_list_element.lua @ 398:714944bda6a0

Make text label of use terms checkbox clickable
author bsw
date Wed Mar 07 13:52:43 2012 +0100 (2012-03-07)
parents 89d32158bfd5
children 699b9fa7bc36
rev   line source
bsw/jbe@19 1 local initiative = param.get("initiative", "table")
bsw@274 2 local selected = param.get("selected", atom.boolean)
bsw/jbe@19 3
bsw@373 4
bsw@373 5 ui.container{ attr = { class = "initiative" }, content = function()
bsw/jbe@19 6
bsw@373 7 ui.container{ attr = { class = "rank" }, content = function()
bsw@373 8 if initiative.issue.accepted and initiative.issue.closed
bsw@373 9 and initiative.issue.ranks_available or initiative.admitted == false
bsw@373 10 then
bsw@373 11 ui.field.rank{ attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
bsw@373 12 else
bsw@375 13 ui.image{ static = "icons/16/script.png" }
bsw@373 14 end
bsw@373 15 end }
bsw@373 16
bsw@373 17 ui.container{ attr = { class = "bar" }, content = function()
bsw@373 18 if initiative.issue.fully_frozen and initiative.issue.closed then
bsw@373 19 if initiative.issue.ranks_available then
bsw@373 20 if initiative.negative_votes and initiative.positive_votes then
bsw@373 21 local max_value = initiative.issue.voter_count
bsw@345 22 ui.bargraph{
bsw@345 23 max_value = max_value,
bsw@345 24 width = 100,
bsw@345 25 bars = {
bsw@373 26 { color = "#0a0", value = initiative.positive_votes },
bsw@373 27 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
bsw@373 28 { color = "#a00", value = initiative.negative_votes },
bsw/jbe@19 29 }
bsw/jbe@19 30 }
bsw@373 31 else
bsw@345 32 slot.put(" ")
bsw@345 33 end
bsw@373 34 else
bsw@373 35 slot.put(_"Counting of votes")
bsw@345 36 end
bsw@373 37 else
bsw@373 38 local max_value = initiative.issue.population or 0
bsw@373 39 ui.bargraph{
bsw@373 40 max_value = max_value,
bsw@373 41 width = 100,
bsw@373 42 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
bsw@373 43 quorum_color = "#00F",
bsw@373 44 bars = {
bsw@373 45 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
bsw@373 46 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
bsw@373 47 { color = "#f7f7f7", value = max_value - (initiative.supporter_count or 0) },
bsw@373 48 }
bsw@373 49 }
bsw@373 50 end
bsw@373 51 end }
bsw@373 52
bsw@373 53 ui.container{ attr = { class = "interest" }, content = function()
bsw@373 54 if initiative.is_initiator then
bsw@373 55 local label = _"You are initiator of this initiative"
bsw@373 56 ui.image{
bsw@373 57 attr = { alt = label, title = label },
bsw@373 58 static = "icons/16/user_edit.png"
bsw@373 59 }
bsw@373 60 elseif initiative.is_supporter then
bsw@373 61 local label = _"You are supporter of this initiative"
bsw@373 62 ui.image{
bsw@373 63 attr = { alt = label, title = label },
bsw@373 64 static = "icons/16/thumb_up_green.png"
bsw@373 65 }
bsw@373 66 elseif initiative.is_potential_supporter then
bsw@373 67 local label = _"You are potentially supporter of this initiative"
bsw@373 68 ui.image{
bsw@373 69 attr = { alt = label, title = label },
bsw@373 70 static = "icons/16/thumb_up.png"
bsw@373 71 }
bsw@373 72 elseif initiative.is_supporter_via_delegation then
bsw@373 73 local label = _"You are supporter of this initiative via delegation"
bsw@373 74 ui.image{
bsw@373 75 attr = { alt = label, title = label },
bsw@373 76 static = "icons/16/thumb_up_green.png"
bsw@373 77 }
bsw@373 78 end
bsw@373 79 end }
bsw@373 80
bsw@373 81 ui.container{ attr = { class = "name" }, content = function()
bsw@373 82 local link_class = "initiative_link"
bsw@373 83 if initiative.revoked then
bsw@373 84 link_class = "revoked"
bsw@373 85 end
bsw@373 86 if selected then
bsw@373 87 link_class = link_class .. " selected"
bsw@373 88 end
bsw@373 89 if initiative.is_supporter then
bsw@373 90 link_class = link_class .. " supported"
bsw@373 91 end
bsw@373 92 if initiative.is_potential_supporter then
bsw@373 93 link_class = link_class .. " potentially_supported"
bsw@373 94 end
bsw@373 95 if initiative.is_supporter_via_delegation then
bsw@373 96 link_class = link_class .. " supported"
bsw@373 97 end
bsw@373 98 ui.link{
bsw@373 99 attr = { class = link_class },
bsw@345 100 content = function()
bsw@373 101 local name
bsw@373 102 if initiative.name_highlighted then
bsw@373 103 name = encode.highlight(initiative.name_highlighted)
bsw@373 104 else
bsw@373 105 name = encode.html(initiative.shortened_name)
bsw@345 106 end
bsw@373 107 ui.tag{ content = "i" .. initiative.id .. ": " }
bsw@373 108 slot.put(name)
bsw@373 109 end,
bsw@373 110 module = "initiative",
bsw@373 111 view = "show",
bsw@373 112 id = initiative.id
bsw@345 113 }
bsw@373 114
bsw@373 115 end }
bsw@373 116
bsw@373 117 end }

Impressum / About Us