liquid_feedback_frontend

diff app/main/area/_head.lua @ 774:a3eb6ca34484

Completed membership/privilege tab in member page
author bsw
date Thu Jun 28 23:57:02 2012 +0200 (2012-06-28)
parents cc542ac26edc
children e07c9ce87470
line diff
     1.1 --- a/app/main/area/_head.lua	Thu Jun 28 23:44:09 2012 +0200
     1.2 +++ b/app/main/area/_head.lua	Thu Jun 28 23:57:02 2012 +0200
     1.3 @@ -1,4 +1,5 @@
     1.4  local area = param.get("area", "table")
     1.5 +local member = param.get("member", "table")
     1.6  
     1.7  local show_content = param.get("show_content", atom.boolean)
     1.8  
     1.9 @@ -10,7 +11,7 @@
    1.10  
    1.11  ui.container{ attr = { class = "area_head" }, content = function()
    1.12  
    1.13 -  execute.view{ module = "delegation", view = "_info", params = { area = area } }
    1.14 +  execute.view{ module = "delegation", view = "_info", params = { area = area, member = member } }
    1.15  
    1.16    ui.container{ attr = { class = "title" }, content = function()
    1.17      -- area name
    1.18 @@ -28,36 +29,37 @@
    1.19        if app.session.member_id then
    1.20  
    1.21          -- membership
    1.22 -        local membership = Membership:by_pk(area.id, app.session.member.id)
    1.23 +        local membership = Membership:by_pk(area.id, member.id)
    1.24  
    1.25          if membership then
    1.26            
    1.27 -          ui.tag{ content = _"You are participating in this area" }
    1.28 -          
    1.29 -          slot.put(" ")
    1.30 -          
    1.31 -          ui.tag{ content = function()
    1.32 -            slot.put("(")
    1.33 -            ui.link{
    1.34 -              text    = _"Withdraw",
    1.35 -              module  = "membership",
    1.36 -              action  = "update",
    1.37 -              params  = { area_id = area.id, delete = true },
    1.38 -              routing = {
    1.39 -                default = {
    1.40 -                  mode = "redirect",
    1.41 -                  module = request.get_module(),
    1.42 -                  view = request.get_view(),
    1.43 -                  id = param.get_id_cgi(),
    1.44 -                  params = param.get_all_cgi()
    1.45 +          if app.session.member_id == member.id then
    1.46 +            ui.tag{ content = _"You are participating in this area" }
    1.47 +            ui.tag{ content = function()
    1.48 +              slot.put("(")
    1.49 +              ui.link{
    1.50 +                text    = _"Withdraw",
    1.51 +                module  = "membership",
    1.52 +                action  = "update",
    1.53 +                params  = { area_id = area.id, delete = true },
    1.54 +                routing = {
    1.55 +                  default = {
    1.56 +                    mode = "redirect",
    1.57 +                    module = request.get_module(),
    1.58 +                    view = request.get_view(),
    1.59 +                    id = param.get_id_cgi(),
    1.60 +                    params = param.get_all_cgi()
    1.61 +                  }
    1.62                  }
    1.63                }
    1.64 -            }
    1.65 -            slot.put(")")
    1.66 -          end }
    1.67 -          
    1.68 +              slot.put(")")
    1.69 +            end }
    1.70 +          else
    1.71 +            ui.tag{ content = _"Member is participating in this area" }
    1.72 +          end
    1.73 +          slot.put(" ")
    1.74  
    1.75 -        elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    1.76 +        elseif app.session.member_id == member.id and member:has_voting_right_for_unit_id(area.unit_id) then
    1.77            ui.link{
    1.78              text   = _"Participate in this area",
    1.79              module = "membership",
    1.80 @@ -75,7 +77,7 @@
    1.81            }
    1.82          end
    1.83          
    1.84 -        if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    1.85 +        if app.session.member_id == member.id and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    1.86  
    1.87            slot.put(" · ")
    1.88            if area.delegation_info.own_delegation_scope ~= "area" then

Impressum / About Us