liquid_feedback_frontend
view app/main/lf2/_area.lua @ 291:71eed60f6a41
Closed branch of experimental frontend
| author | jbe | 
|---|---|
| date | Sat Feb 25 15:56:55 2012 +0100 (2012-02-25) | 
| parents | 73dbc9e2bfd4 | 
| children | 
 line source
     1 local area = param.get("area", "table")
     3 local membership = Membership:by_pk(area.id, app.session.member_id)
     5 local trustees = Member:new_selector()
     6   :add_field("delegation_chain.*")
     7   :join({ "delegation_chain(?, null, ?, null)", app.session.member_id, area.id }, "delegation_chain", "member.id = delegation_chain.member_id")
     8   :add_order_by("index")
     9   :exec()
    12 ui.box{ class = "area", content = function()
    13   ui.box_row{ class = "head", content = function()
    14     ui.box_col{ class = "head left name", content = function()
    15       if membership then
    16         local text = _"You are member of this area"
    17         ui.image{ attr = { title = text, alt = text }, static = "lf2/icon_star.png" }
    18       else
    19       end
    20       slot.put(" ")
    21       ui.tag{ content = area.name }
    22     end }
    23     ui.box_col{ class = "right", content = _("#{direct_count}+#{delegated_count} members", {
    24       direct_count = area.direct_member_count,
    25       delegated_count = area.member_weight - area.direct_member_count 
    26     } ) }
    27   end }
    29   if #trustees > 1 then
    30     ui.box_row{ content = function()
    31       ui.box_col{ class = "left", content = function()
    32         execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
    33       end }
    34     end }
    35   end
    37   ui.box_row{ content = function()
    38     ui.box_col{ class = "left", content = function()
    39       if membership then
    40         ui.link{
    41           module  = "membership", action  = "update", params = { area_id = area.id, delete = true },
    42           routing = { default = {
    43             mode = "redirect", module = "lf2", view = "area", id = area.id
    44           } },
    45           text = _"Give up area membership"
    46         }
    47       else
    48         ui.link{
    49           module  = "membership", action = "update", params = { area_id = area.id },
    50           routing = { default = {
    51             mode = "redirect", module = "lf2", view = "area", id = area.id
    52           } },
    53           text = _"Become a member of this area"
    54         }
    55       end
    56       slot.put(" · ")
    57       if trustees[1].scope_out == "area" then
    58         text = _"Change or revoke area delegation"
    59       else
    60         text = _"Set area delegation"
    61       end  
    62       ui.link{
    63         text = text,
    64         module = "lf2", view = "delegation", params = { area_id = area.id }
    65       }    
    66     end }
    67   end }
    69   if area.description and #area.description > 0 then
    70 --    ui.box_row{ class = "description", content = function() ui.box_col{ content = area.description } end }
    71   end
    73 end }
