liquid_feedback_frontend

annotate app/main/initiative/_list_element.lua @ 292:44f9a09ea51c

Changed colors again, fixed language setting handling for Core 2.0
author bsw
date Sat Feb 25 17:34:51 2012 +0100 (2012-02-25)
parents 6c88b4bfb56c
children 5e6bdf07e3a1
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 local head_name = "initiative_head_" .. tostring(initiative.id)
bsw/jbe@19 5 local link_name = "initiative_link_" .. tostring(initiative.id)
bsw/jbe@19 6 local name = "initiative_content_" .. tostring(initiative.id)
bsw/jbe@19 7 local icon_name = "initiative_icon_" .. tostring(initiative.id)
bsw/jbe@19 8
bsw/jbe@19 9 ui.container{
bsw/jbe@19 10 attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") },
bsw/jbe@19 11 content = function()
bsw/jbe@19 12 local module = "initiative"
bsw/jbe@19 13 local view = "show"
bsw/jbe@19 14 local id = initiative.id
bsw/jbe@19 15 local params = {}
bsw/jbe@19 16 ui.container{
bsw/jbe@19 17 attr = {
bsw/jbe@19 18 name = name,
bsw/jbe@19 19 class = "ui_tabs_accordeon_head",
bsw/jbe@19 20 id = head_name,
bsw/jbe@19 21 },
bsw/jbe@19 22 content = function()
bsw/jbe@19 23
bsw@29 24 ui.list{
bsw@29 25 attr = { class = "nohover" },
bsw@29 26 records = { { a = 1} },
bsw@29 27 columns = {
bsw@29 28 {
bsw@280 29 field_attr = { style = "width: 3em; text-align: center;"},
bsw@29 30 content = function()
bsw@29 31 if initiative.issue.accepted and initiative.issue.closed and initiative.issue.ranks_available or initiative.admitted == false then
bsw@29 32 ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank }
bsw@29 33 else
bsw@29 34 slot.put(" ")
bsw@29 35 end
bsw@29 36 end
bsw@29 37 },
bsw/jbe@19 38
bsw@29 39 {
bsw@280 40 field_attr = { style = "width: 110px;"},
bsw@29 41 content = function()
bsw/jbe@48 42 if initiative.issue.fully_frozen and initiative.issue.closed then
bsw@29 43 if initiative.issue.ranks_available then
bsw@29 44 if initiative.negative_votes and initiative.positive_votes then
bsw@29 45 local max_value = initiative.issue.voter_count
bsw@29 46 ui.bargraph{
bsw@29 47 max_value = max_value,
bsw@29 48 width = 100,
bsw@29 49 bars = {
bsw@29 50 { color = "#0a0", value = initiative.positive_votes },
bsw@29 51 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
bsw@29 52 { color = "#a00", value = initiative.negative_votes },
bsw@29 53 }
bsw@29 54 }
bsw@29 55 else
bsw@29 56 slot.put(" ")
bsw@29 57 end
bsw@29 58 else
bsw@29 59 slot.put(_"Counting of votes")
bsw@29 60 end
bsw@273 61 else
bsw@273 62 local max_value = initiative.issue.population or 0
bsw/jbe@19 63 ui.bargraph{
bsw/jbe@19 64 max_value = max_value,
bsw/jbe@19 65 width = 100,
poelzi@159 66 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
poelzi@159 67 quorum_color = "#00F",
bsw/jbe@19 68 bars = {
bsw@29 69 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
bsw@29 70 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
bsw@29 71 { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
bsw/jbe@19 72 }
bsw/jbe@19 73 }
bsw/jbe@19 74 end
bsw/jbe@19 75 end
bsw@29 76 },
bsw@29 77
bsw@29 78 {
bsw/jbe@19 79 content = function()
bsw@274 80 local link_class = "initiative_link"
bsw@29 81 if initiative.revoked then
bsw@29 82 link_class = "revoked"
bsw/jbe@19 83 end
bsw@274 84 if selected then
bsw@274 85 link_class = link_class .. " selected"
bsw@274 86 end
bsw@274 87 if initiative.is_supporter then
bsw@274 88 link_class = link_class .. " supported"
bsw@274 89 end
bsw@274 90 if initiative.is_potential_supporter then
bsw@274 91 link_class = link_class .. " potentially_supported"
bsw@274 92 end
bsw@285 93 if initiative.is_supporter_via_delegation then
bsw@285 94 link_class = link_class .. " supported"
bsw@285 95 end
bsw@29 96 ui.link{
bsw@29 97 attr = { id = link_name, class = link_class },
bsw@29 98 content = function()
bsw@29 99 local name
bsw@29 100 if initiative.name_highlighted then
bsw@29 101 name = encode.highlight(initiative.name_highlighted)
bsw@29 102 else
bsw@29 103 name = encode.html(initiative.shortened_name)
bsw@29 104 end
bsw@274 105 ui.tag{ content = "i" .. initiative.id .. ": " }
bsw@29 106 slot.put(name)
bsw@29 107 end,
bsw@29 108 module = module,
bsw@29 109 view = view,
bsw@29 110 id = id,
bsw@29 111 params = params,
bsw@29 112 }
bsw@292 113
bsw@292 114 if initiative.is_supporter then
bsw@292 115 slot.put(" ")
bsw@292 116 local label = _"You are supporter of this initiative"
bsw@292 117 ui.image{
bsw@292 118 attr = { alt = label, title = label },
bsw@292 119 static = "icons/16/thumb_up_green.png"
bsw@292 120 }
bsw@292 121 end
bsw@292 122
bsw@292 123 if initiative.is_supporter_via_delegation then
bsw@292 124 slot.put(" ")
bsw@292 125 local label = _"You are supporter of this initiative via delegation"
bsw@292 126 ui.image{
bsw@292 127 attr = { alt = label, title = label },
bsw@292 128 static = "icons/16/thumb_up_green.png"
bsw@292 129 }
bsw@292 130 end
bsw@29 131
bsw@29 132 if initiative.is_initiator then
bsw@29 133 slot.put(" ")
mail@239 134 local label = _"You are initiator of this initiative"
bsw@29 135 ui.image{
bsw@29 136 attr = { alt = label, title = label },
bsw@29 137 static = "icons/16/user_edit.png"
bsw@29 138 }
bsw@29 139 end
bsw@29 140
bsw@29 141 end
bsw/jbe@19 142 }
bsw/jbe@19 143 }
bsw@29 144 }
bsw/jbe@19 145 end
bsw/jbe@19 146 }
bsw/jbe@19 147 end
bsw/jbe@19 148 }
bsw/jbe@19 149
bsw/jbe@19 150 if ui.is_partial_loading_enabled() then
bsw/jbe@19 151 ui.container{
bsw/jbe@19 152 attr = {
bsw/jbe@19 153 id = name,
bsw/jbe@19 154 class = "ui_tabs_accordeon_content",
bsw/jbe@19 155 },
bsw/jbe@19 156 content = function()
bsw/jbe@19 157 ui.container{
bsw/jbe@19 158 attr = { id = name .. "_content", style = "clear: left;" },
bsw/jbe@19 159 content = function()
bsw/jbe@19 160 execute.view{
bsw/jbe@19 161 module = "initiative",
bsw/jbe@19 162 view = "show_partial",
bsw/jbe@19 163 params = {
bsw/jbe@19 164 initiative = initiative,
bsw/jbe@19 165 }
bsw/jbe@19 166 }
bsw/jbe@19 167 end
bsw/jbe@19 168 }
bsw/jbe@19 169 end
bsw/jbe@19 170 }
bsw/jbe@19 171 end

Impressum / About Us