liquid_feedback_frontend

diff app/main/member/_area_list.lua @ 375:89d32158bfd5

Show unit delegatee on member area list, optical enhancements on member area list
author bsw
date Sun Mar 04 14:18:41 2012 +0100 (2012-03-04)
parents aebddf876f67
children 380730df98ed
line diff
     1.1 --- a/app/main/member/_area_list.lua	Sat Mar 03 17:30:16 2012 +0100
     1.2 +++ b/app/main/member/_area_list.lua	Sun Mar 04 14:18:41 2012 +0100
     1.3 @@ -1,37 +1,59 @@
     1.4  local units = app.session.member.units_with_voting_right
     1.5  local member = param.get("member", "table")
     1.6  for i, unit in ipairs(units) do
     1.7 +  local trustee_member = Member:new_selector()
     1.8 +    :join("delegation", nil, { "delegation.unit_id = ? AND delegation.truster_id = ?", unit.id, member.id })
     1.9 +    :optional_object_mode()
    1.10 +    :exec()
    1.11 +  
    1.12    local areas_selector = Area:new_selector()
    1.13      :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
    1.14      :add_where{ "area.unit_id = ?", unit.id }
    1.15      :add_order_by("area.member_weight DESC")
    1.16    
    1.17    local area_count = areas_selector:count()
    1.18 -  local class = "heading"
    1.19 -  if area_count > 0 then
    1.20 -    class = class .. " member_area_list"
    1.21 -  end
    1.22 -  ui.link{
    1.23 -    attr = { class = class },
    1.24 -    text = unit.name,
    1.25 -    module = "unit", view = "show", id = unit.id
    1.26 -  }
    1.27 +  
    1.28 +  ui.container{ attr = { class = "member_area_list" }, content = function()
    1.29 +    ui.container{ attr = { class = "unit_head" }, content = function()
    1.30 +      ui.link{
    1.31 +        text = unit.name,
    1.32 +        module = "unit", view = "show", id = unit.id
    1.33 +      }
    1.34  
    1.35 -  if area_count > 0 then
    1.36 -    execute.view{
    1.37 -      module = "area", view = "_list",
    1.38 -      params = { areas_selector = areas_selector }
    1.39 -    }
    1.40 -  else
    1.41 -    ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
    1.42 -    slot.put(" ")
    1.43 -    ui.link{
    1.44 -      text = _"Show all areas of this unit",
    1.45 -      module = "unit", view = "show", id = unit.id
    1.46 -    }
    1.47 -   end
    1.48 -  slot.put("<br />")
    1.49 -  slot.put("<br />")
    1.50 +      if trustee_member then
    1.51 +        local text = _("Unit delegated to '#{name}'", { name = trustee_member.name })
    1.52 +        ui.image{
    1.53 +          attr = { class = "delegation_arrow", alt = text, title = text },
    1.54 +          static = "delegation_arrow_24_horizontal.png"
    1.55 +        }
    1.56 +        execute.view{
    1.57 +          module = "member_image",
    1.58 +          view = "_show",
    1.59 +          params = {
    1.60 +            member = trustee_member,
    1.61 +            image_type = "avatar",
    1.62 +            show_dummy = true,
    1.63 +            class = "micro_avatar",
    1.64 +            popup_text = text
    1.65 +          }
    1.66 +        }
    1.67 +      end
    1.68 +    end }
    1.69 +
    1.70 +    if area_count > 0 then
    1.71 +      execute.view{
    1.72 +        module = "area", view = "_list",
    1.73 +        params = { areas_selector = areas_selector, hide_membership = true }
    1.74 +      }
    1.75 +    else
    1.76 +      ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
    1.77 +      slot.put(" ")
    1.78 +      ui.link{
    1.79 +        text = _"Show all areas of this unit",
    1.80 +        module = "unit", view = "show", id = unit.id
    1.81 +      }
    1.82 +    end
    1.83 +  end }
    1.84    
    1.85  end
    1.86  

Impressum / About Us