liquid_feedback_frontend
view app/main/area/_head.lua @ 609:2ad52d0067eb
Show when member is locked
| author | bsw | 
|---|---|
| date | Sun Jun 24 23:26:44 2012 +0200 (2012-06-24) | 
| parents | 5ca9de94cb13 | 
| children | 7dc5ab12bfe3 | 
 line source
     1 local area = param.get("area", "table")
     3 local show_content = param.get("show_content", atom.boolean)
     5 area:load_delegation_info_once_for_member_id(app.session.member_id)
     7 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
     9 ui.container{ attr = { class = "area_head" }, content = function()
    11   execute.view{ module = "delegation", view = "_info", params = { area = area } }
    13   ui.container{ attr = { class = "title" }, content = function()
    14     -- area name
    15     ui.link{
    16       module = "area", view = "show", id = area.id,
    17       attr = { class = "area_name" }, content = area.name 
    18     }
    19   end }
    21   if show_content then
    23     ui.container{ attr = { class = "content" }, content = function()
    25       -- actions (members with appropriate voting right only)
    26       if app.session.member_id then
    28         -- membership
    29         local membership = Membership:by_pk(area.id, app.session.member.id)
    31         if membership then
    33           ui.tag{ content = _"You are participating in this area" }
    35           slot.put(" ")
    37           ui.tag{ content = function()
    38             slot.put("(")
    39             ui.link{
    40               text    = _"Withdraw",
    41               module  = "membership",
    42               action  = "update",
    43               params  = { area_id = area.id, delete = true },
    44               routing = {
    45                 default = {
    46                   mode = "redirect",
    47                   module = request.get_module(),
    48                   view = request.get_view(),
    49                   id = param.get_id_cgi(),
    50                   params = param.get_all_cgi()
    51                 }
    52               }
    53             }
    54             slot.put(")")
    55           end }
    58         elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    59           ui.link{
    60             text   = _"Participate in this area",
    61             module = "membership",
    62             action = "update",
    63             params = { area_id = area.id },
    64             routing = {
    65               default = {
    66                 mode = "redirect",
    67                 module = request.get_module(),
    68                 view = request.get_view(),
    69                 id = param.get_id_cgi(),
    70                 params = param.get_all_cgi()
    71               }
    72             }
    73           }
    75         end
    77         slot.put(" · ")
    78         if area.delegation_info.own_delegation_scope ~= "area" then
    79           ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
    80         else
    81           ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
    82         end
    83         slot.put(" · ")
    85         -- create new issue
    86         if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    87           ui.link{
    88             content = function()
    89               slot.put(_"Create new issue")
    90             end,
    91             module = "initiative",
    92             view = "new",
    93             params = { area_id = area.id }
    94           }
    95         end
    97       end
    99     end }
   101   else
   102     slot.put("<br />")
   103   end
   105 end }
