liquid_feedback_frontend

annotate app/main/initiative/_list_element.lua @ 586:95f214d91956

Fixed member drop down menu
author bsw
date Wed Jun 20 22:21:29 2012 +0200 (2012-06-20)
parents 53f93f0ffa6e
children ea89fa21b0ab
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/jbe@19 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@414 12 elseif not initiative.issue.closed then
bsw@414 13 ui.image{ static = "icons/16/script.png" }
bsw@373 14 else
bsw@414 15 ui.image{ static = "icons/16/cross.png" }
bsw@373 16 end
bsw@373 17 end }
bsw@373 18
bsw@373 19 ui.container{ attr = { class = "bar" }, content = function()
bsw@373 20 if initiative.issue.fully_frozen and initiative.issue.closed then
bsw@373 21 if initiative.issue.ranks_available then
bsw@373 22 if initiative.negative_votes and initiative.positive_votes then
bsw@373 23 local max_value = initiative.issue.voter_count
bsw@345 24 ui.bargraph{
bsw@345 25 max_value = max_value,
bsw@345 26 width = 100,
bsw@345 27 bars = {
bsw@373 28 { color = "#0a0", value = initiative.positive_votes },
bsw@373 29 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
bsw@373 30 { color = "#a00", value = initiative.negative_votes },
bsw/jbe@19 31 }
bsw/jbe@19 32 }
bsw@373 33 else
bsw@345 34 slot.put(" ")
bsw@345 35 end
bsw@373 36 else
bsw@373 37 slot.put(_"Counting of votes")
bsw/jbe@19 38 end
bsw@373 39 else
bsw@373 40 local max_value = initiative.issue.population or 0
bsw@534 41 local quorum
bsw@534 42 if initiative.issue.accepted then
bsw@534 43 quorum = initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den
bsw@534 44 else
bsw@534 45 quorum = initiative.issue.policy.issue_quorum_num / initiative.issue.policy.issue_quorum_den
bsw@534 46 end
bsw@373 47 ui.bargraph{
bsw@373 48 max_value = max_value,
bsw@373 49 width = 100,
bsw@534 50 quorum = max_value * quorum,
bsw@373 51 quorum_color = "#00F",
bsw@373 52 bars = {
bsw@373 53 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
bsw@501 54 { color = "#999", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
bsw@501 55 { color = "#ddd", value = max_value - (initiative.supporter_count or 0) },
bsw@373 56 }
bsw/jbe@19 57 }
bsw/jbe@19 58 end
bsw@373 59 end }
bsw@373 60
bsw@556 61 if app.session.member_id then
bsw@556 62 ui.container{ attr = { class = "interest" }, content = function()
bsw@556 63 if initiative.member_info.initiated then
bsw@556 64 local label = _"You are initiator of this initiative"
bsw@551 65 ui.image{
bsw@551 66 attr = { alt = label, title = label },
bsw@556 67 static = "icons/16/user_edit.png"
bsw@551 68 }
bsw@556 69 elseif initiative.member_info.directly_supported then
bsw@556 70 if initiative.member_info.satisfied then
bsw@556 71 local label = _"You are supporter of this initiative"
bsw@556 72 ui.image{
bsw@556 73 attr = { alt = label, title = label },
bsw@556 74 static = "icons/16/thumb_up_green.png"
bsw@556 75 }
bsw@556 76 else
bsw@556 77 local label = _"You are potential supporter of this initiative"
bsw@556 78 ui.image{
bsw@556 79 attr = { alt = label, title = label },
bsw@556 80 static = "icons/16/thumb_up.png"
bsw@556 81 }
bsw@556 82 end
bsw@556 83 elseif initiative.member_info.supported then
bsw@556 84 if initiative.member_info.satisfied then
bsw@556 85 local label = _"You are supporter of this initiative via delegation"
bsw@556 86 ui.image{
bsw@556 87 attr = { alt = label, title = label },
bsw@556 88 static = "icons/16/thumb_up_green_arrow.png"
bsw@556 89 }
bsw@556 90 else
bsw@556 91 local label = _"You are potential supporter of this initiative via delegation"
bsw@556 92 ui.image{
bsw@556 93 attr = { alt = label, title = label },
bsw@556 94 static = "icons/16/thumb_up_arrow.png"
bsw@556 95 }
bsw@556 96 end
bsw@551 97 end
bsw@556 98 end }
bsw@556 99 end
bsw@556 100
bsw@373 101 ui.container{ attr = { class = "name" }, content = function()
bsw@373 102 local link_class = "initiative_link"
bsw@373 103 if initiative.revoked then
bsw@373 104 link_class = "revoked"
bsw@373 105 end
bsw@373 106 if selected then
bsw@373 107 link_class = link_class .. " selected"
bsw@373 108 end
bsw@373 109 if initiative.is_supporter then
bsw@373 110 link_class = link_class .. " supported"
bsw@373 111 end
bsw@373 112 if initiative.is_potential_supporter then
bsw@373 113 link_class = link_class .. " potentially_supported"
bsw@373 114 end
bsw@373 115 if initiative.is_supporter_via_delegation then
bsw@373 116 link_class = link_class .. " supported"
bsw@373 117 end
bsw@373 118 ui.link{
bsw@373 119 attr = { class = link_class },
bsw@345 120 content = function()
bsw@373 121 local name
bsw@373 122 if initiative.name_highlighted then
bsw@373 123 name = encode.highlight(initiative.name_highlighted)
bsw@373 124 else
bsw@373 125 name = encode.html(initiative.shortened_name)
bsw@345 126 end
bsw@373 127 ui.tag{ content = "i" .. initiative.id .. ": " }
bsw@373 128 slot.put(name)
bsw@373 129 end,
bsw@373 130 module = "initiative",
bsw@373 131 view = "show",
bsw@373 132 id = initiative.id
bsw@345 133 }
bsw@373 134
bsw@373 135 end }
bsw@373 136
bsw@534 137 end }

Impressum / About Us