liquid_feedback_frontend

diff env/ui/bargraph.lua @ 159:5d797c6706d5

implement quorum display

show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
author Daniel Poelzleithner <poelzi@poelzi.org>
date Sat Oct 09 03:42:48 2010 +0200 (2010-10-09)
parents 00d1004545f1
children 03c205fc17f0
line diff
     1.1 --- a/env/ui/bargraph.lua	Fri Oct 08 20:36:56 2010 +0200
     1.2 +++ b/env/ui/bargraph.lua	Sat Oct 09 03:42:48 2010 +0200
     1.3 @@ -13,10 +13,33 @@
     1.4      },
     1.5      content = function()
     1.6        local at_least_one_bar = false
     1.7 +      local quorum = args.quorum and args.quorum * args.width / args.max_value or nil
     1.8 +      local length = 0
     1.9        for i, bar in ipairs(args.bars) do
    1.10          if bar.value > 0 then
    1.11            at_least_one_bar = true
    1.12            local value = bar.value * args.width / args.max_value
    1.13 +          if quorum and quorum < length + value then
    1.14 +            local dlength = math.max(quorum - length - 1, 0)
    1.15 +            if dlength > 0 then
    1.16 +              ui.container{
    1.17 +                attr = {
    1.18 +                  style = "width: " .. tostring(dlength) .. "px; background-color: " .. bar.color .. ";",
    1.19 +                },
    1.20 +                content = function() slot.put("&nbsp;") end
    1.21 +              }
    1.22 +            end
    1.23 +            ui.container{
    1.24 +              attr = {
    1.25 +                style = "width: 1px; background-color: " .. (args.quorum_color or "blue") ..";",
    1.26 +              },
    1.27 +              content = function() slot.put("&nbsp;") end
    1.28 +            }
    1.29 +            length = dlength + 1
    1.30 +            value = value - dlength
    1.31 +            quorum = nil
    1.32 +          end
    1.33 +          length = length + value
    1.34            ui.container{
    1.35              attr = {
    1.36                style = "width: " .. tostring(value) .. "px; background-color: " .. bar.color .. ";",

Impressum / About Us