liquid_feedback_frontend

diff app/main/supporter/_show_box.lua @ 0:3bfb2fcf7ab9

Version alpha1
author bsw/jbe
date Wed Nov 18 12:00:00 2009 +0100 (2009-11-18)
parents
children 5c601807d397
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/supporter/_show_box.lua	Wed Nov 18 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +    
     1.5 +
     1.6 +slot.select("support", function()
     1.7 +
     1.8 +  local initiative = param.get("initiative", "table")
     1.9 +
    1.10 +  if not initiative.issue.frozen and not initiative.issue.closed then
    1.11 +
    1.12 +    local supported = Supporter:by_pk(initiative.id, app.session.member.id) and true or false
    1.13 +
    1.14 +    local text
    1.15 +    if supported then
    1.16 +      text = _"Direct supporter [change]"
    1.17 +    else
    1.18 +      text = _"No supporter [change]"
    1.19 +    end
    1.20 +    ui.container{
    1.21 +      attr = {
    1.22 +        class = "head",
    1.23 +        style = "cursor: pointer;",
    1.24 +        onclick = "document.getElementById('support_content').style.display = 'block';"
    1.25 +      },
    1.26 +      content = text
    1.27 +    }
    1.28 +
    1.29 +
    1.30 +    ui.container{
    1.31 +      attr = { class = "content", id = "support_content" },
    1.32 +      content = function()
    1.33 +        if supported then
    1.34 +          ui.link{
    1.35 +            content = function()
    1.36 +              ui.image{ static = "icons/16/thumb_down_red.png" }
    1.37 +              slot.put(_"Remove my support from this initiative")
    1.38 +            end,
    1.39 +            module = "initiative",
    1.40 +            action = "remove_support",
    1.41 +            id = initiative.id
    1.42 +          }
    1.43 +        else
    1.44 +          ui.link{
    1.45 +            content = function()
    1.46 +              ui.image{ static = "icons/16/thumb_up_green.png" }
    1.47 +              slot.put(_"Support this initiative")
    1.48 +            end,
    1.49 +            module = "initiative",
    1.50 +            action = "add_support",
    1.51 +            id = initiative.id
    1.52 +          }
    1.53 +        end
    1.54 +      end
    1.55 +    }
    1.56 +  end
    1.57 +
    1.58 +end)

Impressum / About Us