liquid_feedback_frontend

annotate app/main/initiative/_list_element.lua @ 862:a1ff5d08f0f4

Displays correct avatar when showing delegation chain preview for other member
author bsw
date Fri Aug 17 19:54:41 2012 +0200 (2012-08-17)
parents 21ae6ff8629a
children ae9ab3edff89
rev   line source
bsw/jbe@19 1 local initiative = param.get("initiative", "table")
bsw@274 2 local selected = param.get("selected", atom.boolean)
bsw@862 3 local for_member = param.get("for_member", "table") or app.session.member
bsw/jbe@19 4
bsw@715 5 local class = "initiative"
bsw/jbe@19 6
bsw@715 7 if selected then
bsw@715 8 class = class .. " selected"
bsw@715 9 end
bsw@715 10
bsw@715 11 ui.container{ attr = { class = class }, content = function()
bsw/jbe@19 12
bsw@373 13 ui.container{ attr = { class = "rank" }, content = function()
bsw@373 14 if initiative.issue.accepted and initiative.issue.closed
bsw@373 15 and initiative.issue.ranks_available or initiative.admitted == false
bsw@373 16 then
bsw@373 17 ui.field.rank{ attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
bsw@414 18 elseif not initiative.issue.closed then
bsw@414 19 ui.image{ static = "icons/16/script.png" }
bsw@373 20 else
bsw@414 21 ui.image{ static = "icons/16/cross.png" }
bsw@373 22 end
bsw@373 23 end }
bsw@373 24
bsw@373 25 ui.container{ attr = { class = "bar" }, content = function()
bsw@373 26 if initiative.issue.fully_frozen and initiative.issue.closed then
bsw@373 27 if initiative.issue.ranks_available then
bsw@373 28 if initiative.negative_votes and initiative.positive_votes then
bsw@373 29 local max_value = initiative.issue.voter_count
bsw@345 30 ui.bargraph{
bsw@345 31 max_value = max_value,
bsw@345 32 width = 100,
bsw@345 33 bars = {
bsw@674 34 { color = "#0a5", value = initiative.positive_votes },
bsw@373 35 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
bsw@373 36 { color = "#a00", value = initiative.negative_votes },
bsw/jbe@19 37 }
bsw/jbe@19 38 }
bsw@373 39 else
bsw@345 40 slot.put(" ")
bsw@345 41 end
bsw@373 42 else
bsw@373 43 slot.put(_"Counting of votes")
bsw/jbe@19 44 end
bsw@373 45 else
bsw@373 46 local max_value = initiative.issue.population or 0
bsw@534 47 local quorum
bsw@534 48 if initiative.issue.accepted then
bsw@534 49 quorum = initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den
bsw@534 50 else
bsw@534 51 quorum = initiative.issue.policy.issue_quorum_num / initiative.issue.policy.issue_quorum_den
bsw@534 52 end
bsw@373 53 ui.bargraph{
bsw@373 54 max_value = max_value,
bsw@373 55 width = 100,
bsw@534 56 quorum = max_value * quorum,
bsw@373 57 quorum_color = "#00F",
bsw@373 58 bars = {
bsw@642 59 { color = "#0a5", value = (initiative.satisfied_supporter_count or 0) },
bsw@642 60 { color = "#aaa", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
bsw@642 61 { color = "#fff", value = max_value - (initiative.supporter_count or 0) },
bsw@373 62 }
bsw/jbe@19 63 }
bsw/jbe@19 64 end
bsw@373 65 end }
bsw@373 66
bsw@556 67 if app.session.member_id then
bsw@556 68 ui.container{ attr = { class = "interest" }, content = function()
bsw@556 69 if initiative.member_info.initiated then
bsw@862 70 local label
bsw@862 71 if for_member and for_member.id ~= app.session.member_id then
bsw@862 72 label = _"This member is initiator of this initiative"
bsw@862 73 else
bsw@862 74 label = _"You are initiator of this initiative"
bsw@862 75 end
bsw@551 76 ui.image{
bsw@551 77 attr = { alt = label, title = label },
bsw@556 78 static = "icons/16/user_edit.png"
bsw@551 79 }
bsw@556 80 elseif initiative.member_info.directly_supported then
bsw@556 81 if initiative.member_info.satisfied then
bsw@862 82 if for_member and for_member.id ~= app.session.member_id then
bsw@862 83 label = _"This member is supporter of this initiative"
bsw@862 84 else
bsw@862 85 local label = _"You are supporter of this initiative"
bsw@862 86 end
bsw@556 87 ui.image{
bsw@556 88 attr = { alt = label, title = label },
bsw@556 89 static = "icons/16/thumb_up_green.png"
bsw@556 90 }
bsw@556 91 else
bsw@862 92 if for_member and for_member.id ~= app.session.member_id then
bsw@862 93 label = _"This member is potential supporter of this initiative"
bsw@862 94 else
bsw@862 95 local label = _"You are potential supporter of this initiative"
bsw@862 96 end
bsw@556 97 ui.image{
bsw@556 98 attr = { alt = label, title = label },
bsw@556 99 static = "icons/16/thumb_up.png"
bsw@556 100 }
bsw@556 101 end
bsw@556 102 elseif initiative.member_info.supported then
bsw@556 103 if initiative.member_info.satisfied then
bsw@862 104 if for_member and for_member.id ~= app.session.member_id then
bsw@862 105 label = _"This member is supporter of this initiative via delegation"
bsw@862 106 else
bsw@862 107 local label = _"You are supporter of this initiative via delegation"
bsw@862 108 end
bsw@556 109 ui.image{
bsw@556 110 attr = { alt = label, title = label },
bsw@556 111 static = "icons/16/thumb_up_green_arrow.png"
bsw@556 112 }
bsw@556 113 else
bsw@862 114 if for_member and for_member.id ~= app.session.member_id then
bsw@862 115 label = _"This member is potential supporter of this initiative via delegation"
bsw@862 116 else
bsw@862 117 local label = _"You are potential supporter of this initiative via delegation"
bsw@862 118 end
bsw@556 119 ui.image{
bsw@556 120 attr = { alt = label, title = label },
bsw@556 121 static = "icons/16/thumb_up_arrow.png"
bsw@556 122 }
bsw@556 123 end
bsw@551 124 end
bsw@556 125 end }
bsw@556 126 end
bsw@556 127
bsw@373 128 ui.container{ attr = { class = "name" }, content = function()
bsw@373 129 local link_class = "initiative_link"
bsw@373 130 if initiative.revoked then
bsw@373 131 link_class = "revoked"
bsw@373 132 end
bsw@373 133 ui.link{
bsw@373 134 attr = { class = link_class },
bsw@345 135 content = function()
bsw@373 136 local name
bsw@373 137 if initiative.name_highlighted then
bsw@373 138 name = encode.highlight(initiative.name_highlighted)
bsw@373 139 else
bsw@373 140 name = encode.html(initiative.shortened_name)
bsw@345 141 end
bsw@373 142 ui.tag{ content = "i" .. initiative.id .. ": " }
bsw@373 143 slot.put(name)
bsw@373 144 end,
bsw@373 145 module = "initiative",
bsw@373 146 view = "show",
bsw@373 147 id = initiative.id
bsw@345 148 }
bsw@373 149
bsw@373 150 end }
bsw@373 151
bsw@534 152 end }

Impressum / About Us