liquid_feedback_frontend

annotate app/main/initiative/_list_element.lua @ 20:0a23f39b3e21

Esperanto translation strings added
author Dinu Gherman
date Sat Feb 20 22:14:38 2010 +0100 (2010-02-20)
parents 00d1004545f1
children b195682957dc
rev   line source
bsw/jbe@19 1 local initiative = param.get("initiative", "table")
bsw/jbe@19 2 local expanded = param.get("expanded", atom.boolean)
bsw/jbe@19 3 local expandable = param.get("expandable", atom.boolean)
bsw/jbe@19 4
bsw/jbe@19 5 local head_name = "initiative_head_" .. tostring(initiative.id)
bsw/jbe@19 6 local link_name = "initiative_link_" .. tostring(initiative.id)
bsw/jbe@19 7 local name = "initiative_content_" .. tostring(initiative.id)
bsw/jbe@19 8 local icon_name = "initiative_icon_" .. tostring(initiative.id)
bsw/jbe@19 9
bsw/jbe@19 10 ui.container{
bsw/jbe@19 11 attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") },
bsw/jbe@19 12 content = function()
bsw/jbe@19 13 local web20 = config.user_tab_mode == "accordeon"
bsw/jbe@19 14 or config.user_tab_mode == "accordeon_first_expanded"
bsw/jbe@19 15 or config.user_tab_mode == "accordeon_all_expanded"
bsw/jbe@19 16 local onclick
bsw/jbe@19 17 if web20 then
bsw/jbe@19 18 if expandable then
bsw/jbe@19 19 onclick =
bsw/jbe@19 20 'if (lf_initiative_expanded["' .. name .. '"]) {' ..
bsw/jbe@19 21 'lf_initiative_expanded["' .. name .. '"]=false;' ..
bsw/jbe@19 22 'document.getElementById("' .. name .. '_content").innerHTML=" ";' ..
bsw/jbe@19 23 'document.getElementById("' .. name .. '").style.display="none";' ..
bsw/jbe@19 24 '} else {' ..
bsw/jbe@19 25 'lf_initiative_expanded["' .. name .. '"] = true;' ..
bsw/jbe@19 26 'document.getElementById("' .. name .. '").style.display="block"; ' ..
bsw/jbe@19 27 'var hourglass_el = document.getElementById("' .. icon_name .. '");' ..
bsw/jbe@19 28 'var hourglass_src = hourglass_el.src;' ..
bsw/jbe@19 29 'hourglass_el.src = "' .. encode.url{ static = "icons/16/connect.png" } .. '";' ..
bsw/jbe@19 30 'partialMultiLoad(' ..
bsw/jbe@19 31 '{ trace: "trace", system_error: "system_error", ' .. name .. '_content: "default" },' ..
bsw/jbe@19 32 '{},' ..
bsw/jbe@19 33 '"error",' ..
bsw/jbe@19 34 '"' .. request.get_relative_baseurl() .. 'initiative/show_partial/' .. tostring(initiative.id) .. '.html?&_webmcp_json_slots[]=default&_webmcp_json_slots[]=support&_webmcp_json_slots[]=trace&_webmcp_json_slots[]=system_error",' ..
bsw/jbe@19 35 '{},' ..
bsw/jbe@19 36 '{},' ..
bsw/jbe@19 37 'function() {' ..
bsw/jbe@19 38 'hourglass_el.src = hourglass_src;' ..
bsw/jbe@19 39 '},' ..
bsw/jbe@19 40 'function() {' ..
bsw/jbe@19 41 'hourglass_el.src = hourglass_src;' ..
bsw/jbe@19 42 '}' ..
bsw/jbe@19 43 '); ' ..
bsw/jbe@19 44 '}' ..
bsw/jbe@19 45 'return(false);'
bsw/jbe@19 46 else
bsw/jbe@19 47 onclick = "document.location.href = document.getElementById('" .. link_name .. "').href;"
bsw/jbe@19 48 end
bsw/jbe@19 49 end
bsw/jbe@19 50 local module = "initiative"
bsw/jbe@19 51 local view = "show"
bsw/jbe@19 52 local id = initiative.id
bsw/jbe@19 53 local params = {}
bsw/jbe@19 54 ui.container{
bsw/jbe@19 55 attr = {
bsw/jbe@19 56 name = name,
bsw/jbe@19 57 class = "ui_tabs_accordeon_head",
bsw/jbe@19 58 id = head_name,
bsw/jbe@19 59 onclick = onclick,
bsw/jbe@19 60 },
bsw/jbe@19 61 content = function()
bsw/jbe@19 62
bsw/jbe@19 63 ui.container{
bsw/jbe@19 64 attr = { style = "float: left; width: 4em;"},
bsw/jbe@19 65 content = function()
bsw/jbe@19 66 if initiative.issue.accepted and initiative.issue.closed and initiative.issue.ranks_available or initiative.admitted == false then
bsw/jbe@19 67 ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank }
bsw/jbe@19 68 elseif web20 then
bsw/jbe@19 69 ui.image{
bsw/jbe@19 70 attr = {
bsw/jbe@19 71 width = 16,
bsw/jbe@19 72 height = 16,
bsw/jbe@19 73 id = icon_name,
bsw/jbe@19 74 style = "float: left;"
bsw/jbe@19 75 },
bsw/jbe@19 76 static = "icons/16/script.png"
bsw/jbe@19 77 }
bsw/jbe@19 78 else
bsw/jbe@19 79 slot.put(" ")
bsw/jbe@19 80 end
bsw/jbe@19 81 end
bsw/jbe@19 82 }
bsw/jbe@19 83
bsw/jbe@19 84 ui.container{
bsw/jbe@19 85 attr = { style = "float: left; width: 110px;"},
bsw/jbe@19 86 content = function()
bsw/jbe@19 87 if initiative.issue.accepted and initiative.issue.closed then
bsw/jbe@19 88 if initiative.issue.ranks_available then
bsw/jbe@19 89 if initiative.negative_votes and initiative.positive_votes then
bsw/jbe@19 90 local max_value = initiative.issue.voter_count
bsw/jbe@19 91 ui.bargraph{
bsw/jbe@19 92 max_value = max_value,
bsw/jbe@19 93 width = 100,
bsw/jbe@19 94 bars = {
bsw/jbe@19 95 { color = "#0a0", value = initiative.positive_votes },
bsw/jbe@19 96 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
bsw/jbe@19 97 { color = "#a00", value = initiative.negative_votes },
bsw/jbe@19 98 }
bsw/jbe@19 99 }
bsw/jbe@19 100 else
bsw/jbe@19 101 slot.put(" ")
bsw/jbe@19 102 end
bsw/jbe@19 103 else
bsw/jbe@19 104 slot.put(_"Counting of votes")
bsw/jbe@19 105 end
bsw/jbe@19 106 elseif initiative.issue.population then
bsw/jbe@19 107 local max_value = initiative.issue.population
bsw/jbe@19 108 ui.bargraph{
bsw/jbe@19 109 max_value = max_value,
bsw/jbe@19 110 width = 100,
bsw/jbe@19 111 bars = {
bsw/jbe@19 112 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
bsw/jbe@19 113 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
bsw/jbe@19 114 { color = "#eee", value = max_value - (initiative.supporter_count or 0) },
bsw/jbe@19 115 }
bsw/jbe@19 116 }
bsw/jbe@19 117 else
bsw/jbe@19 118 slot.put(" ")
bsw/jbe@19 119 end
bsw/jbe@19 120 end
bsw/jbe@19 121 }
bsw/jbe@19 122
bsw/jbe@19 123 ui.container{
bsw/jbe@19 124 attr = { style = "float: left;"},
bsw/jbe@19 125 content = function()
bsw/jbe@19 126 local link_class
bsw/jbe@19 127 if initiative.revoked then
bsw/jbe@19 128 link_class = "revoked"
bsw/jbe@19 129 end
bsw/jbe@19 130 ui.link{
bsw/jbe@19 131 attr = { id = link_name, class = link_class },
bsw/jbe@19 132 content = function()
bsw/jbe@19 133 local name
bsw/jbe@19 134 if initiative.name_highlighted then
bsw/jbe@19 135 name = encode.highlight(initiative.name_highlighted)
bsw/jbe@19 136 else
bsw/jbe@19 137 name = encode.html(initiative.name)
bsw/jbe@19 138 end
bsw/jbe@19 139 slot.put(name)
bsw/jbe@19 140 end,
bsw/jbe@19 141 module = module,
bsw/jbe@19 142 view = view,
bsw/jbe@19 143 id = id,
bsw/jbe@19 144 params = params,
bsw/jbe@19 145 }
bsw/jbe@19 146 end
bsw/jbe@19 147 }
bsw/jbe@19 148
bsw/jbe@19 149 if initiative.issue.state == "new" then
bsw/jbe@19 150 ui.image{
bsw/jbe@19 151 static = "icons/16/new.png"
bsw/jbe@19 152 }
bsw/jbe@19 153 end
bsw/jbe@19 154 if initiative.is_supporter then
bsw/jbe@19 155 slot.put(" ")
bsw/jbe@19 156 local label = _"You are supporting this initiative"
bsw/jbe@19 157 ui.image{
bsw/jbe@19 158 attr = { alt = label, title = label },
bsw/jbe@19 159 static = "icons/16/thumb_up_green.png"
bsw/jbe@19 160 }
bsw/jbe@19 161 end
bsw/jbe@19 162 if initiative.is_potential_supporter then
bsw/jbe@19 163 slot.put(" ")
bsw/jbe@19 164 local label = _"You are potential supporter of this initiative"
bsw/jbe@19 165 ui.image{
bsw/jbe@19 166 attr = { alt = label, title = label },
bsw/jbe@19 167 static = "icons/16/thumb_up.png"
bsw/jbe@19 168 }
bsw/jbe@19 169 end
bsw/jbe@19 170 if initiative.is_initiator then
bsw/jbe@19 171 slot.put(" ")
bsw/jbe@19 172 local label = _"You are iniator of this initiative"
bsw/jbe@19 173 ui.image{
bsw/jbe@19 174 attr = { alt = label, title = label },
bsw/jbe@19 175 static = "icons/16/user_edit.png"
bsw/jbe@19 176 }
bsw/jbe@19 177 end
bsw/jbe@19 178
bsw/jbe@19 179 slot.put("<br style='clear: left' />")
bsw/jbe@19 180 end
bsw/jbe@19 181 }
bsw/jbe@19 182 end
bsw/jbe@19 183 }
bsw/jbe@19 184
bsw/jbe@19 185 if ui.is_partial_loading_enabled() then
bsw/jbe@19 186 ui.container{
bsw/jbe@19 187 attr = {
bsw/jbe@19 188 id = name,
bsw/jbe@19 189 class = "ui_tabs_accordeon_content",
bsw/jbe@19 190 style = not expanded and "display: none;" or nil
bsw/jbe@19 191 },
bsw/jbe@19 192 content = function()
bsw/jbe@19 193 ui.container{
bsw/jbe@19 194 attr = { id = name .. "_content", style = "clear: left;" },
bsw/jbe@19 195 content = function()
bsw/jbe@19 196 execute.view{
bsw/jbe@19 197 module = "initiative",
bsw/jbe@19 198 view = "show_partial",
bsw/jbe@19 199 params = {
bsw/jbe@19 200 initiative = initiative,
bsw/jbe@19 201 expanded = expanded
bsw/jbe@19 202 }
bsw/jbe@19 203 }
bsw/jbe@19 204 end
bsw/jbe@19 205 }
bsw/jbe@19 206 end
bsw/jbe@19 207 }
bsw/jbe@19 208 end

Impressum / About Us