liquid_feedback_frontend

changeset 774:a3eb6ca34484

Completed membership/privilege tab in member page
author bsw
date Thu Jun 28 23:57:02 2012 +0200 (2012-06-28)
parents ea4c1b3a443c
children c9d1dce78975
files app/main/area/_head.lua app/main/area/_list_entry.lua app/main/delegation/_info.lua app/main/index/_member_home.lua app/main/member/_show.lua app/main/unit/_head.lua
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
     2.1 --- a/app/main/area/_list_entry.lua	Thu Jun 28 23:44:09 2012 +0200
     2.2 +++ b/app/main/area/_list_entry.lua	Thu Jun 28 23:57:02 2012 +0200
     2.3 @@ -1,8 +1,9 @@
     2.4  local area = param.get("area", "table")
     2.5 +local member = param.get("member", "table")
     2.6  
     2.7  ui.container{ attr = { class = "area" }, content = function()
     2.8  
     2.9 -  execute.view{ module = "area", view = "_head", params = { area = area, hide_unit = true, show_content = true } }
    2.10 +  execute.view{ module = "area", view = "_head", params = { area = area, hide_unit = true, show_content = true, member = member } }
    2.11    
    2.12    ui.container{ attr = { class = "content" }, content = function()
    2.13      ui.tag{ content = _"Issues:" }
     3.1 --- a/app/main/delegation/_info.lua	Thu Jun 28 23:44:09 2012 +0200
     3.2 +++ b/app/main/delegation/_info.lua	Thu Jun 28 23:57:02 2012 +0200
     3.3 @@ -2,6 +2,8 @@
     3.4    return
     3.5  end
     3.6  
     3.7 +local member = param.get("member", "table") or app.session.member
     3.8 +
     3.9  local unit  = param.get("unit", "table")
    3.10  local area  = param.get("area", "table")
    3.11  local issue = param.get("issue", "table")
    3.12 @@ -19,15 +21,13 @@
    3.13  end
    3.14  
    3.15  if area then
    3.16 -  area:load_delegation_info_once_for_member_id(app.session.member_id)
    3.17 +  area:load_delegation_info_once_for_member_id(member.id)
    3.18    info = area.delegation_info
    3.19    delegation_text = _"Delegate area"
    3.20  end
    3.21  
    3.22  if issue then
    3.23 -  if app.session.member_id then
    3.24 -    info = issue.member_info
    3.25 -  end
    3.26 +  info = issue.member_info
    3.27    delegation_text = _"Delegate issue"
    3.28  end
    3.29  
    3.30 @@ -53,7 +53,7 @@
    3.31          end
    3.32          
    3.33          execute.view{ module = "member_image", view = "_show", params = {
    3.34 -          member = app.session.member, class = class, popup_text = app.session.member.name,
    3.35 +          member = member, class = class, popup_text = member.name,
    3.36            image_type = "avatar", show_dummy = true,
    3.37          } }
    3.38  
    3.39 @@ -139,7 +139,7 @@
    3.40            }
    3.41  
    3.42            execute.view{ module = "member_image", view = "_show", params = {
    3.43 -            member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
    3.44 +            member = member, class = "micro_avatar", popup_text = member.name,
    3.45              image_type = "avatar", show_dummy = true,
    3.46            } }
    3.47  
     4.1 --- a/app/main/index/_member_home.lua	Thu Jun 28 23:44:09 2012 +0200
     4.2 +++ b/app/main/index/_member_home.lua	Thu Jun 28 23:57:02 2012 +0200
     4.3 @@ -106,7 +106,7 @@
     4.4      end
     4.5  
     4.6      ui.container{ attr = { class = "area_list" }, content = function()
     4.7 -      execute.view{ module = "unit", view = "_head", params = { unit = unit, show_content = true } }
     4.8 +      execute.view{ module = "unit", view = "_head", params = { unit = unit, show_content = true, member = member } }
     4.9  
    4.10        if area_count > 0 then
    4.11          local areas = areas_selector:exec()
    4.12 @@ -116,7 +116,7 @@
    4.13          for i, area in ipairs(areas) do
    4.14            execute.view{
    4.15              module = "area", view = "_list_entry", params = {
    4.16 -              area = area
    4.17 +              area = area, member = member
    4.18              }
    4.19            }
    4.20          end
     5.1 --- a/app/main/member/_show.lua	Thu Jun 28 23:44:09 2012 +0200
     5.2 +++ b/app/main/member/_show.lua	Thu Jun 28 23:57:02 2012 +0200
     5.3 @@ -20,7 +20,7 @@
     5.4  local areas_selector = member:get_reference_selector("areas")
     5.5  tabs[#tabs+1] = {
     5.6    name = "areas",
     5.7 -  label = _"Units",
     5.8 +  label = _"Units and areas",
     5.9    icon = { static = "icons/16/package.png" },
    5.10    module = "index",
    5.11    view = "_member_home",
     6.1 --- a/app/main/unit/_head.lua	Thu Jun 28 23:44:09 2012 +0200
     6.2 +++ b/app/main/unit/_head.lua	Thu Jun 28 23:57:02 2012 +0200
     6.3 @@ -1,4 +1,5 @@
     6.4  local unit = param.get("unit", "table")
     6.5 +local member = param.get("member", "table")
     6.6  
     6.7  local show_content = param.get("show_content", atom.boolean)
     6.8  
     6.9 @@ -6,7 +7,7 @@
    6.10  
    6.11  ui.container{ attr = { class = "unit_head" }, content = function()
    6.12  
    6.13 -  execute.view{ module = "delegation", view = "_info", params = { unit = unit } }
    6.14 +  execute.view{ module = "delegation", view = "_info", params = { unit = unit, member = member } }
    6.15  
    6.16    ui.container{ attr = { class = "title" }, content = function()
    6.17      if not config.single_unit_id then
    6.18 @@ -25,13 +26,17 @@
    6.19    if show_content then
    6.20      ui.container{ attr = { class = "content" }, content = function()
    6.21  
    6.22 -      if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then
    6.23 -        ui.tag{ content = _"You have voting privileges for this unit" }
    6.24 -        slot.put(" · ")
    6.25 -        if unit.delegation_info.first_trustee_id == nil then
    6.26 -          ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } }
    6.27 +      if member and member:has_voting_right_for_unit_id(unit.id) then
    6.28 +        if app.session.member_id == member.id then
    6.29 +          ui.tag{ content = _"You have voting privileges for this unit" }
    6.30 +          slot.put(" · ")
    6.31 +          if unit.delegation_info.first_trustee_id == nil then
    6.32 +            ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } }
    6.33 +          else
    6.34 +            ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } }
    6.35 +          end
    6.36          else
    6.37 -          ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } }
    6.38 +          ui.tag{ content = _"Member has voting privileges for this unit" }
    6.39          end
    6.40        end
    6.41      end }

Impressum / About Us