liquid_feedback_frontend
view app/main/area/_head.lua @ 689:f9a9915ad1cd
Optical improvements
| author | bsw | 
|---|---|
| date | Tue Jun 26 18:11:13 2012 +0200 (2012-06-26) | 
| parents | cc542ac26edc | 
| children | a3eb6ca34484 | 
 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 if not param.get("hide_unit", atom.boolean) then
     8   execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
     9 end
    11 ui.container{ attr = { class = "area_head" }, content = function()
    13   execute.view{ module = "delegation", view = "_info", params = { area = area } }
    15   ui.container{ attr = { class = "title" }, content = function()
    16     -- area name
    17     ui.link{
    18       module = "area", view = "show", id = area.id,
    19       attr = { class = "area_name" }, content = area.name 
    20     }
    21   end }
    23   if show_content then
    25     ui.container{ attr = { class = "content" }, content = function()
    27       -- actions (members with appropriate voting right only)
    28       if app.session.member_id then
    30         -- membership
    31         local membership = Membership:by_pk(area.id, app.session.member.id)
    33         if membership then
    35           ui.tag{ content = _"You are participating in this area" }
    37           slot.put(" ")
    39           ui.tag{ content = function()
    40             slot.put("(")
    41             ui.link{
    42               text    = _"Withdraw",
    43               module  = "membership",
    44               action  = "update",
    45               params  = { area_id = area.id, delete = true },
    46               routing = {
    47                 default = {
    48                   mode = "redirect",
    49                   module = request.get_module(),
    50                   view = request.get_view(),
    51                   id = param.get_id_cgi(),
    52                   params = param.get_all_cgi()
    53                 }
    54               }
    55             }
    56             slot.put(")")
    57           end }
    60         elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    61           ui.link{
    62             text   = _"Participate in this area",
    63             module = "membership",
    64             action = "update",
    65             params = { area_id = area.id },
    66             routing = {
    67               default = {
    68                 mode = "redirect",
    69                 module = request.get_module(),
    70                 view = request.get_view(),
    71                 id = param.get_id_cgi(),
    72                 params = param.get_all_cgi()
    73               }
    74             }
    75           }
    76         end
    78         if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    80           slot.put(" · ")
    81           if area.delegation_info.own_delegation_scope ~= "area" then
    82             ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
    83           else
    84             ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
    85           end
    86           slot.put(" · ")
    88           ui.link{
    89             content = function()
    90               slot.put(_"Create new issue")
    91             end,
    92             module = "initiative",
    93             view = "new",
    94             params = { area_id = area.id }
    95           }
    96         end
    98       end
   100     end }
   102   else
   103     slot.put("<br />")
   104   end
   106 end }
