liquid_feedback_frontend

changeset 345:7d6a3c411f99

Code cleanup (removed code not needed any more)
author bsw
date Tue Feb 28 22:27:19 2012 +0100 (2012-02-28)
parents 6be42327b67f
children 3f2ae4f7a045
files app/main/initiative/_list.lua app/main/initiative/_list_element.lua app/main/issue/_list.lua app/main/issue/_list_initiatives.lua env/ui/bargraph_legend.lua static/style.css
line diff
     1.1 --- a/app/main/initiative/_list.lua	Tue Feb 28 22:14:13 2012 +0100
     1.2 +++ b/app/main/initiative/_list.lua	Tue Feb 28 22:27:19 2012 +0100
     1.3 @@ -28,204 +28,123 @@
     1.4  local limit = param.get("limit", atom.number)
     1.5  local no_sort = param.get("no_sort", atom.boolean)
     1.6  
     1.7 -local show_for_issue = param.get("show_for_issue", atom.boolean)
     1.8 -
     1.9 -local show_for_initiative
    1.10 -
    1.11 -local show_for_initiative_id = param.get("for_initiative_id", atom.number)
    1.12 -
    1.13 -if show_for_initiative_id then
    1.14 -  show_for_initiative = Initiative:by_id(show_for_initiative_id)
    1.15 -
    1.16 -elseif not show_for_initiative_id and show_for_issue and issue and issue.ranks_available then
    1.17 -  winning_initiative = Initiative:new_selector()
    1.18 -    :add_where{ "issue_id = ?", issue.id }
    1.19 -    :add_where("rank = 1")
    1.20 -    :optional_object_mode()
    1.21 -    :exec()
    1.22 -  if winning_initiative then
    1.23 -    show_for_initiative = winning_initiative
    1.24 -    ui.container{
    1.25 -      attr = { class = "admitted_info" },
    1.26 -      content = _"This issue has been finished with the following winning initiative:"
    1.27 -    }
    1.28 -  else
    1.29 -    ui.container{
    1.30 -      attr = { class = "not_admitted_info" },
    1.31 -      content = _"This issue has been finished without any winning initiative."
    1.32 -    }
    1.33 +local more_initiatives_count
    1.34 +if limit then
    1.35 +  if initiatives_count > limit then
    1.36 +    more_initiatives_count = initiatives_count - limit
    1.37    end
    1.38 +  initiatives_selector:limit(limit)
    1.39  end
    1.40  
    1.41 +local issue = param.get("issue", "table")
    1.42  
    1.43 -if show_for_initiative then
    1.44 -  initiatives_selector:add_where{ "initiative.id != ?", show_for_initiative.id }
    1.45 +local name = "initiative_list"
    1.46 +if issue then
    1.47 +  name = "issue_" .. tostring(issue.id) ..  "_initiative_list"
    1.48 +end
    1.49 +
    1.50 +ui.add_partial_param_names{ name }
    1.51  
    1.52 -  execute.view{
    1.53 -    module = "initiative",
    1.54 -    view = "_list_element",
    1.55 -    params = {
    1.56 -      initiative = show_for_initiative,
    1.57 -    }
    1.58 -  }
    1.59 -  if show_for_issue then
    1.60 -    slot.put("<br />")
    1.61 -    ui.container{
    1.62 -      attr = { style = "font-weight: bold;" },
    1.63 -      content = function()
    1.64 -        slot.put(_"Alternative initiatives")
    1.65 -      end
    1.66 -    }
    1.67 -  end
    1.68 -elseif show_for_issue then
    1.69 -  ui.container{
    1.70 -    attr = { style = "font-weight: bold;" },
    1.71 -    content = function()
    1.72 -      slot.put(_"Alternative initiatives")
    1.73 -    end
    1.74 +local order_filter = {
    1.75 +  name = name,
    1.76 +  label = _"Order by"
    1.77 +}
    1.78 +
    1.79 +if issue and issue.ranks_available then
    1.80 +  order_filter[#order_filter+1] = {
    1.81 +    name = "rank",
    1.82 +    label = _"Rank",
    1.83 +    selector_modifier = function(selector) selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id") end
    1.84    }
    1.85  end
    1.86  
    1.87 -if not show_for_initiative or initiatives_count > 1 then
    1.88 -
    1.89 +order_filter[#order_filter+1] = {
    1.90 +  name = "potential_support",
    1.91 +  label = _"Potential support",
    1.92 +  selector_modifier = function(selector) selector:add_order_by("CASE WHEN issue.population = 0 THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id") end
    1.93 +}
    1.94  
    1.95 -  local more_initiatives_count
    1.96 -  if limit then
    1.97 -    limit = limit - (show_for_initiative and 1 or 0)
    1.98 -    if initiatives_count > limit then
    1.99 -      more_initiatives_count = initiatives_count - limit
   1.100 -    end
   1.101 -    initiatives_selector:limit(limit)
   1.102 -  end
   1.103 -
   1.104 -  local issue = param.get("issue", "table")
   1.105 -
   1.106 -  local name = "initiative_list"
   1.107 -  if issue then
   1.108 -    name = "issue_" .. tostring(issue.id) ..  "_initiative_list"
   1.109 -  end
   1.110 -
   1.111 -  ui.add_partial_param_names{ name }
   1.112 +order_filter[#order_filter+1] = {
   1.113 +  name = "support",
   1.114 +  label = _"Support",
   1.115 +  selector_modifier = function(selector) selector:add_order_by("initiative.satisfied_supporter_count::float / issue.population::float DESC, initiative.id") end
   1.116 +}
   1.117  
   1.118 -  local order_filter = {
   1.119 -    name = name,
   1.120 -    label = _"Order by"
   1.121 -  }
   1.122 +order_filter[#order_filter+1] = {
   1.123 +  name = "newest",
   1.124 +  label = _"Newest",
   1.125 +  selector_modifier = function(selector) selector:add_order_by("initiative.created DESC, initiative.id") end
   1.126 +}
   1.127  
   1.128 -  if issue and issue.ranks_available then
   1.129 -    order_filter[#order_filter+1] = {
   1.130 -      name = "rank",
   1.131 -      label = _"Rank",
   1.132 -      selector_modifier = function(selector) selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id") end
   1.133 -    }
   1.134 -  end
   1.135 +order_filter[#order_filter+1] = {
   1.136 +  name = "oldest",
   1.137 +  label = _"Oldest",
   1.138 +  selector_modifier = function(selector) selector:add_order_by("initiative.created, initiative.id") end
   1.139 +}
   1.140  
   1.141 -  order_filter[#order_filter+1] = {
   1.142 -    name = "potential_support",
   1.143 -    label = _"Potential support",
   1.144 -    selector_modifier = function(selector) selector:add_order_by("CASE WHEN issue.population = 0 THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id") end
   1.145 -  }
   1.146 -
   1.147 -  order_filter[#order_filter+1] = {
   1.148 -    name = "support",
   1.149 -    label = _"Support",
   1.150 -    selector_modifier = function(selector) selector:add_order_by("initiative.satisfied_supporter_count::float / issue.population::float DESC, initiative.id") end
   1.151 -  }
   1.152 +ui_filters = ui.filters
   1.153  
   1.154 -  order_filter[#order_filter+1] = {
   1.155 -    name = "newest",
   1.156 -    label = _"Newest",
   1.157 -    selector_modifier = function(selector) selector:add_order_by("initiative.created DESC, initiative.id") end
   1.158 -  }
   1.159 -
   1.160 -  order_filter[#order_filter+1] = {
   1.161 -    name = "oldest",
   1.162 -    label = _"Oldest",
   1.163 -    selector_modifier = function(selector) selector:add_order_by("initiative.created, initiative.id") end
   1.164 -  }
   1.165 -
   1.166 -  ui_filters = ui.filters
   1.167 -
   1.168 -  if no_sort then
   1.169 -    ui_filters = function(args) args.content() end
   1.170 -    if issue.ranks_available then
   1.171 -      initiatives_selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id")
   1.172 -    else
   1.173 -      initiatives_selector:add_order_by("CASE WHEN issue.population = 0 OR initiative.supporter_count = 0 OR initiative.supporter_count ISNULL THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id")
   1.174 -    end
   1.175 +if no_sort then
   1.176 +  ui_filters = function(args) args.content() end
   1.177 +  if issue.ranks_available then
   1.178 +    initiatives_selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id")
   1.179 +  else
   1.180 +    initiatives_selector:add_order_by("CASE WHEN issue.population = 0 OR initiative.supporter_count = 0 OR initiative.supporter_count ISNULL THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id")
   1.181    end
   1.182 +end
   1.183  
   1.184 -  ui_filters{
   1.185 -    label = _"Change order",
   1.186 -    order_filter,
   1.187 -    selector = initiatives_selector,
   1.188 -    content = function()
   1.189 -      ui.paginate{
   1.190 -        name = issue and "issue_" .. tostring(issue.id) .. "_page" or nil,
   1.191 -        selector = initiatives_selector,
   1.192 -        per_page = param.get("per_page", atom.number) or limit,
   1.193 -        content = function()
   1.194 -          local initiatives = initiatives_selector:exec()
   1.195 -          if highlight_initiative then
   1.196 -            local highlight_initiative_found
   1.197 -            for i, initiative in ipairs(initiatives) do
   1.198 -              if initiative.id == highlight_initiative.id then
   1.199 -                highhighlight_initiative_found = true
   1.200 -              end
   1.201 -            end
   1.202 -            if not highhighlight_initiative_found then
   1.203 -              initiatives[#initiatives+1] = highlight_initiative
   1.204 -              if more_initiatives_count then
   1.205 -                more_initiatives_count = more_initiatives_count - 1
   1.206 -              end
   1.207 +ui_filters{
   1.208 +  label = _"Change order",
   1.209 +  order_filter,
   1.210 +  selector = initiatives_selector,
   1.211 +  content = function()
   1.212 +    ui.paginate{
   1.213 +      name = issue and "issue_" .. tostring(issue.id) .. "_page" or nil,
   1.214 +      selector = initiatives_selector,
   1.215 +      per_page = param.get("per_page", atom.number) or limit,
   1.216 +      content = function()
   1.217 +        local initiatives = initiatives_selector:exec()
   1.218 +        if highlight_initiative then
   1.219 +          local highlight_initiative_found
   1.220 +          for i, initiative in ipairs(initiatives) do
   1.221 +            if initiative.id == highlight_initiative.id then
   1.222 +              highhighlight_initiative_found = true
   1.223              end
   1.224            end
   1.225 -          for i, initiative in ipairs(initiatives) do
   1.226 -            execute.view{
   1.227 -              module = "initiative",
   1.228 -              view = "_list_element",
   1.229 -              params = {
   1.230 -                initiative = initiative,
   1.231 -                selected = highlight_initiative and highlight_initiative.id == initiative.id or nil,
   1.232 -              }
   1.233 -            }
   1.234 +          if not highhighlight_initiative_found then
   1.235 +            initiatives[#initiatives+1] = highlight_initiative
   1.236 +            if more_initiatives_count then
   1.237 +              more_initiatives_count = more_initiatives_count - 1
   1.238 +            end
   1.239            end
   1.240          end
   1.241 -      }
   1.242 -    end
   1.243 -  }
   1.244 -
   1.245 -  if more_initiatives_count and more_initiatives_count > 0 then
   1.246 -    local text
   1.247 -    if more_initiatives_count == 1 then
   1.248 -      text = _("and one more initiative")
   1.249 -    else
   1.250 -      text = _("and #{count} more initiatives", { count = more_initiatives_count })
   1.251 -    end
   1.252 -    ui.link{
   1.253 -      attr = { class = "more_initiatives_link" },
   1.254 -      content = text,
   1.255 -      module = "issue",
   1.256 -      view = "show",
   1.257 -      id = issue.id,
   1.258 -    }
   1.259 -  end
   1.260 -
   1.261 -end
   1.262 -
   1.263 -if show_for_issue then
   1.264 -  slot.put("<br />")
   1.265 -  
   1.266 -  if issue and initiatives_count == 1 then
   1.267 -    ui.container{
   1.268 -      content = function()
   1.269 -        if issue.fully_frozen or issue.closed then
   1.270 -          slot.put(_"There were no more alternative initiatives.")
   1.271 -        else
   1.272 -          slot.put(_"There are no more alternative initiatives currently.")
   1.273 +        for i, initiative in ipairs(initiatives) do
   1.274 +          execute.view{
   1.275 +            module = "initiative",
   1.276 +            view = "_list_element",
   1.277 +            params = {
   1.278 +              initiative = initiative,
   1.279 +              selected = highlight_initiative and highlight_initiative.id == initiative.id or nil,
   1.280 +            }
   1.281 +          }
   1.282          end
   1.283        end
   1.284      }
   1.285    end
   1.286 +}
   1.287  
   1.288 +if more_initiatives_count and more_initiatives_count > 0 then
   1.289 +  local text
   1.290 +  if more_initiatives_count == 1 then
   1.291 +    text = _("and one more initiative")
   1.292 +  else
   1.293 +    text = _("and #{count} more initiatives", { count = more_initiatives_count })
   1.294 +  end
   1.295 +  ui.link{
   1.296 +    attr = { class = "more_initiatives_link" },
   1.297 +    content = text,
   1.298 +    module = "issue",
   1.299 +    view = "show",
   1.300 +    id = issue.id,
   1.301 +  }
   1.302  end
     2.1 --- a/app/main/initiative/_list_element.lua	Tue Feb 28 22:14:13 2012 +0100
     2.2 +++ b/app/main/initiative/_list_element.lua	Tue Feb 28 22:27:19 2012 +0100
     2.3 @@ -1,181 +1,133 @@
     2.4  local initiative = param.get("initiative", "table")
     2.5  local selected = param.get("selected", atom.boolean)
     2.6  
     2.7 -local head_name = "initiative_head_" ..    tostring(initiative.id)
     2.8 -local link_name = "initiative_link_" ..    tostring(initiative.id)
     2.9 -local name      = "initiative_content_" .. tostring(initiative.id)
    2.10 -local icon_name = "initiative_icon_" ..    tostring(initiative.id)
    2.11 -
    2.12 -ui.container{
    2.13 -  attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") },
    2.14 -  content = function()
    2.15 -    local module = "initiative"
    2.16 -    local view = "show"
    2.17 -    local id = initiative.id
    2.18 -    local params = {}
    2.19 -    ui.container{
    2.20 -      attr = {
    2.21 -        name = name,
    2.22 -        class = "ui_tabs_accordeon_head",
    2.23 -        id = head_name,
    2.24 -      },
    2.25 +ui.list{
    2.26 +  attr = { class = "nohover" },
    2.27 +  records = { { a = 1} },
    2.28 +  columns = {
    2.29 +    {
    2.30 +      field_attr = { style = "width: 3em; text-align: center;"},
    2.31        content = function()
    2.32 -
    2.33 -        ui.list{
    2.34 -          attr = { class = "nohover" },
    2.35 -          records = { { a = 1} },
    2.36 -          columns = {
    2.37 -            {
    2.38 -              field_attr = { style = "width: 3em; text-align: center;"},
    2.39 -              content = function()
    2.40 -                if
    2.41 -                  initiative.issue.accepted and initiative.issue.closed
    2.42 -                  and initiative.issue.ranks_available or initiative.admitted == false
    2.43 -                then 
    2.44 -                  ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
    2.45 -                else
    2.46 -                  slot.put("&nbsp;")
    2.47 -                end
    2.48 -              end
    2.49 -            },
    2.50 +        if
    2.51 +          initiative.issue.accepted and initiative.issue.closed
    2.52 +          and initiative.issue.ranks_available or initiative.admitted == false
    2.53 +        then 
    2.54 +          ui.field.rank{ attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
    2.55 +        else
    2.56 +          slot.put("&nbsp;")
    2.57 +        end
    2.58 +      end
    2.59 +    },
    2.60  
    2.61 -            {
    2.62 -              field_attr = { style = "width: 100px;"},
    2.63 -              content = function()
    2.64 -                if initiative.issue.fully_frozen and initiative.issue.closed then
    2.65 -                  if initiative.issue.ranks_available then 
    2.66 -                    if initiative.negative_votes and initiative.positive_votes then
    2.67 -                      local max_value = initiative.issue.voter_count
    2.68 -                      ui.bargraph{
    2.69 -                        max_value = max_value,
    2.70 -                        width = 100,
    2.71 -                        bars = {
    2.72 -                          { color = "#0a0", value = initiative.positive_votes },
    2.73 -                          { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
    2.74 -                          { color = "#a00", value = initiative.negative_votes },
    2.75 -                        }
    2.76 -                      }
    2.77 -                    else
    2.78 -                      slot.put("&nbsp;")
    2.79 -                    end
    2.80 -                  else
    2.81 -                    slot.put(_"Counting of votes")
    2.82 -                  end
    2.83 -                else
    2.84 -                  local max_value = initiative.issue.population or 0
    2.85 -                  ui.bargraph{
    2.86 -                    max_value = max_value,
    2.87 -                    width = 100,
    2.88 -                    quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
    2.89 -                    quorum_color = "#00F",
    2.90 -                    bars = {
    2.91 -                      { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
    2.92 -                      { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
    2.93 -                      { color = "#f7f7f7", value = max_value - (initiative.supporter_count or 0) },
    2.94 -                    }
    2.95 -                  }
    2.96 -                end
    2.97 -              end
    2.98 -            },
    2.99 -            {
   2.100 -              field_attr = { style = "width: 24px;" },
   2.101 -              content = function()
   2.102 -                if initiative.is_initiator then
   2.103 -                  slot.put("&nbsp;")
   2.104 -                  local label = _"You are initiator of this initiative"
   2.105 -                  ui.image{
   2.106 -                    attr = { alt = label, title = label },
   2.107 -                    static = "icons/16/user_edit.png"
   2.108 -                  }
   2.109 -                elseif initiative.is_supporter then
   2.110 -                  slot.put("&nbsp;")
   2.111 -                  local label = _"You are supporter of this initiative"
   2.112 -                  ui.image{
   2.113 -                    attr = { alt = label, title = label },
   2.114 -                    static = "icons/16/thumb_up_green.png"
   2.115 -                  }
   2.116 -                elseif initiative.is_potential_supporter then
   2.117 -                  slot.put("&nbsp;")
   2.118 -                  local label = _"You are potentially supporter of this initiative"
   2.119 -                  ui.image{
   2.120 -                    attr = { alt = label, title = label },
   2.121 -                    static = "icons/16/thumb_up.png"
   2.122 -                  }
   2.123 -                elseif initiative.is_supporter_via_delegation then
   2.124 -                  slot.put("&nbsp;")
   2.125 -                  local label = _"You are supporter of this initiative via delegation"
   2.126 -                  ui.image{
   2.127 -                    attr = { alt = label, title = label },
   2.128 -                    static = "icons/16/thumb_up_green.png"
   2.129 -                  }
   2.130 -                end
   2.131 -    
   2.132 -              end
   2.133 -            },
   2.134 -            {
   2.135 -              content = function()
   2.136 -                local link_class = "initiative_link"
   2.137 -                if initiative.revoked then
   2.138 -                  link_class = "revoked"
   2.139 -                end
   2.140 -                if selected then
   2.141 -                  link_class = link_class .. " selected"
   2.142 -                end
   2.143 -                if initiative.is_supporter then
   2.144 -                  link_class = link_class .. " supported"
   2.145 -                end
   2.146 -                if initiative.is_potential_supporter then
   2.147 -                  link_class = link_class .. " potentially_supported"
   2.148 -                end
   2.149 -                if initiative.is_supporter_via_delegation then
   2.150 -                  link_class = link_class .. " supported"
   2.151 -                end
   2.152 -                ui.link{
   2.153 -                  attr = { id = link_name, class = link_class },
   2.154 -                  content = function()
   2.155 -                    local name
   2.156 -                    if initiative.name_highlighted then
   2.157 -                      name = encode.highlight(initiative.name_highlighted)
   2.158 -                    else
   2.159 -                      name = encode.html(initiative.shortened_name)
   2.160 -                    end
   2.161 -                    ui.tag{ content = "i" .. initiative.id .. ": " }
   2.162 -                    slot.put(name)
   2.163 -                  end,
   2.164 -                  module  = module,
   2.165 -                  view    = view,
   2.166 -                  id      = id,
   2.167 -                  params  = params,
   2.168 +    {
   2.169 +      field_attr = { style = "width: 100px;"},
   2.170 +      content = function()
   2.171 +        if initiative.issue.fully_frozen and initiative.issue.closed then
   2.172 +          if initiative.issue.ranks_available then 
   2.173 +            if initiative.negative_votes and initiative.positive_votes then
   2.174 +              local max_value = initiative.issue.voter_count
   2.175 +              ui.bargraph{
   2.176 +                max_value = max_value,
   2.177 +                width = 100,
   2.178 +                bars = {
   2.179 +                  { color = "#0a0", value = initiative.positive_votes },
   2.180 +                  { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
   2.181 +                  { color = "#a00", value = initiative.negative_votes },
   2.182                  }
   2.183 -                  
   2.184 -              end
   2.185 -            }
   2.186 -          }
   2.187 -        }
   2.188 -      end
   2.189 -    }
   2.190 -  end
   2.191 -}
   2.192 -
   2.193 -if ui.is_partial_loading_enabled() then
   2.194 -  ui.container{
   2.195 -    attr = {
   2.196 -      id = name,
   2.197 -      class = "ui_tabs_accordeon_content",
   2.198 -    },
   2.199 -    content = function()
   2.200 -      ui.container{
   2.201 -        attr = { id = name .. "_content", style = "clear: left;" },
   2.202 -        content = function()
   2.203 -          execute.view{
   2.204 -            module = "initiative",
   2.205 -            view = "show_partial",
   2.206 -            params = {
   2.207 -              initiative = initiative,
   2.208 +              }
   2.209 +            else
   2.210 +              slot.put("&nbsp;")
   2.211 +            end
   2.212 +          else
   2.213 +            slot.put(_"Counting of votes")
   2.214 +          end
   2.215 +        else
   2.216 +          local max_value = initiative.issue.population or 0
   2.217 +          ui.bargraph{
   2.218 +            max_value = max_value,
   2.219 +            width = 100,
   2.220 +            quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
   2.221 +            quorum_color = "#00F",
   2.222 +            bars = {
   2.223 +              { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
   2.224 +              { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
   2.225 +              { color = "#f7f7f7", value = max_value - (initiative.supporter_count or 0) },
   2.226              }
   2.227            }
   2.228          end
   2.229 -      }
   2.230 -    end
   2.231 +      end
   2.232 +    },
   2.233 +    {
   2.234 +      field_attr = { style = "width: 24px;" },
   2.235 +      content = function()
   2.236 +        if initiative.is_initiator then
   2.237 +          slot.put("&nbsp;")
   2.238 +          local label = _"You are initiator of this initiative"
   2.239 +          ui.image{
   2.240 +            attr = { alt = label, title = label },
   2.241 +            static = "icons/16/user_edit.png"
   2.242 +          }
   2.243 +        elseif initiative.is_supporter then
   2.244 +          slot.put("&nbsp;")
   2.245 +          local label = _"You are supporter of this initiative"
   2.246 +          ui.image{
   2.247 +            attr = { alt = label, title = label },
   2.248 +            static = "icons/16/thumb_up_green.png"
   2.249 +          }
   2.250 +        elseif initiative.is_potential_supporter then
   2.251 +          slot.put("&nbsp;")
   2.252 +          local label = _"You are potentially supporter of this initiative"
   2.253 +          ui.image{
   2.254 +            attr = { alt = label, title = label },
   2.255 +            static = "icons/16/thumb_up.png"
   2.256 +          }
   2.257 +        elseif initiative.is_supporter_via_delegation then
   2.258 +          slot.put("&nbsp;")
   2.259 +          local label = _"You are supporter of this initiative via delegation"
   2.260 +          ui.image{
   2.261 +            attr = { alt = label, title = label },
   2.262 +            static = "icons/16/thumb_up_green.png"
   2.263 +          }
   2.264 +        end
   2.265 +
   2.266 +      end
   2.267 +    },
   2.268 +    {
   2.269 +      content = function()
   2.270 +        local link_class = "initiative_link"
   2.271 +        if initiative.revoked then
   2.272 +          link_class = "revoked"
   2.273 +        end
   2.274 +        if selected then
   2.275 +          link_class = link_class .. " selected"
   2.276 +        end
   2.277 +        if initiative.is_supporter then
   2.278 +          link_class = link_class .. " supported"
   2.279 +        end
   2.280 +        if initiative.is_potential_supporter then
   2.281 +          link_class = link_class .. " potentially_supported"
   2.282 +        end
   2.283 +        if initiative.is_supporter_via_delegation then
   2.284 +          link_class = link_class .. " supported"
   2.285 +        end
   2.286 +        ui.link{
   2.287 +          attr = { class = link_class },
   2.288 +          content = function()
   2.289 +            local name
   2.290 +            if initiative.name_highlighted then
   2.291 +              name = encode.highlight(initiative.name_highlighted)
   2.292 +            else
   2.293 +              name = encode.html(initiative.shortened_name)
   2.294 +            end
   2.295 +            ui.tag{ content = "i" .. initiative.id .. ": " }
   2.296 +            slot.put(name)
   2.297 +          end,
   2.298 +          module  = "initiative",
   2.299 +          view    = "show",
   2.300 +          id      = initiative.id
   2.301 +        }
   2.302 +          
   2.303 +      end
   2.304 +    }
   2.305    }
   2.306 -end
   2.307 \ No newline at end of file
   2.308 +}
     3.1 --- a/app/main/issue/_list.lua	Tue Feb 28 22:14:13 2012 +0100
     3.2 +++ b/app/main/issue/_list.lua	Tue Feb 28 22:27:19 2012 +0100
     3.3 @@ -185,30 +185,3 @@
     3.4  else
     3.5    ui.filters(filters)
     3.6  end
     3.7 -
     3.8 ---[[
     3.9 -if param.get("legend", atom.boolean) ~= false then
    3.10 -  local filter = param.get_all_cgi().filter
    3.11 -  if not filter or filter == "any" or filter ~= "finished" then
    3.12 -    ui.bargraph_legend{
    3.13 -      width = 25,
    3.14 -      bars = {
    3.15 -        { color = "#0a0", label = _"Supporter" },
    3.16 -        { color = "#777", label = _"Potential supporter" },
    3.17 -        { color = "#ddd", label = _"No support at all" },
    3.18 -      }
    3.19 -    }
    3.20 -  end
    3.21 -  if not filter or filter == "any" or filter == "finished" then
    3.22 -    ui.bargraph_legend{
    3.23 -      width = 25,
    3.24 -      bars = {
    3.25 -        { color = "#0a0", label = _"Yes" },
    3.26 -        { color = "#aaa", label = _"Abstention" },
    3.27 -        { color = "#a00", label = _"No" },
    3.28 -      }
    3.29 -    }
    3.30 -  end
    3.31 -end
    3.32 -
    3.33 ---]]
    3.34 \ No newline at end of file
     4.1 --- a/app/main/issue/_list_initiatives.lua	Tue Feb 28 22:14:13 2012 +0100
     4.2 +++ b/app/main/issue/_list_initiatives.lua	Tue Feb 28 22:27:19 2012 +0100
     4.3 @@ -9,9 +9,6 @@
     4.4        params = {
     4.5          initiatives_selector = issue:get_reference_selector("initiatives"),
     4.6          issue = issue,
     4.7 -        expandable = true,
     4.8 -        for_initiative_id = param.get("for_initiative_id", atom.number),
     4.9 -        xshow_for_issue = true,
    4.10          no_sort = true
    4.11        }
    4.12      }
     5.1 --- a/env/ui/bargraph_legend.lua	Tue Feb 28 22:14:13 2012 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,32 +0,0 @@
     5.4 -function ui.bargraph_legend(attr)
     5.5 -  local width = assert(attr.width)
     5.6 -  local bars = assert(attr.bars)
     5.7 -
     5.8 -  ui.container{
     5.9 -    attr = { class = "bargraph_legend" },
    5.10 -    content = function()
    5.11 -      ui.container{
    5.12 -        attr = { class = "bargraph_legend_label" },
    5.13 -        content = _"Legend:"
    5.14 -      }
    5.15 -      for i, bar in ipairs(bars) do
    5.16 -        ui.bargraph{
    5.17 -          max_value = 1,
    5.18 -          width = width,
    5.19 -          bars = {
    5.20 -            {
    5.21 -              color = bar.color,
    5.22 -              value = 1,
    5.23 -            }
    5.24 -          }
    5.25 -        }
    5.26 -        ui.container{
    5.27 -          attr = { class = "bargraph_legend_label" },
    5.28 -          content = bar.label
    5.29 -        }
    5.30 -      end
    5.31 -    end
    5.32 -  }
    5.33 -
    5.34 -  slot.put('<br style="clear: left;" />')
    5.35 -end
    5.36 \ No newline at end of file
     6.1 --- a/static/style.css	Tue Feb 28 22:14:13 2012 +0100
     6.2 +++ b/static/style.css	Tue Feb 28 22:27:19 2012 +0100
     6.3 @@ -661,25 +661,6 @@
     6.4    height: 1.3ex;
     6.5  }
     6.6  
     6.7 -.bargraph_legend {
     6.8 -  margin-top: 2ex;
     6.9 -}
    6.10 -
    6.11 -.bargraph_legend .bargraph {
    6.12 -  width: 26px;
    6.13 -}
    6.14 -
    6.15 -.bargraph_legend div,
    6.16 -.bargraph_legend div div,
    6.17 -.bargraph_legend div div div {
    6.18 -  float: left;
    6.19 -}
    6.20 -
    6.21 -.bargraph_legend_label {
    6.22 -  margin-left: 0.5em;
    6.23 -  margin-right: 1em;
    6.24 -}
    6.25 -
    6.26  /*************************************************************************
    6.27   * vertical ui.form
    6.28   */

Impressum / About Us