liquid_feedback_frontend
view app/main/area/_head.lua @ 792:8dbf04a404e7
Optical enhancements
| author | bsw | 
|---|---|
| date | Fri Jun 29 00:49:09 2012 +0200 (2012-06-29) | 
| parents | e370594368e8 | 
| children | 7878f3c20a86 | 
 line source
     1 local area = param.get("area", "table")
     2 local member = param.get("member", "table")
     4 local show_content = param.get("show_content", atom.boolean)
     6 area:load_delegation_info_once_for_member_id(app.session.member_id)
     8 if not param.get("hide_unit", atom.boolean) then
     9   execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
    10 end
    12 ui.container{ attr = { class = "area_head" }, content = function()
    14   execute.view{ module = "delegation", view = "_info", params = { area = area, member = member } }
    16   ui.container{ attr = { class = "title" }, content = function()
    17     -- area name
    18     ui.link{
    19       module = "area", view = "show", id = area.id,
    20       attr = { class = "area_name" }, content = area.name 
    21     }
    22   end }
    24   if show_content then
    26     ui.container{ attr = { class = "content" }, content = function()
    28       -- actions (members with appropriate voting right only)
    29       if member then
    31         -- membership
    32         local membership = Membership:by_pk(area.id, member.id)
    34         if membership then
    36           if app.session.member_id == member.id then
    37             ui.tag{ content = _"You are participating in this area" }
    38             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 }
    58           else
    59             ui.tag{ content = _"Member is participating in this area" }
    60           end
    62         elseif app.session.member_id == member.id and member:has_voting_right_for_unit_id(area.unit_id) then
    63           ui.link{
    64             text   = _"Participate in this area",
    65             module = "membership",
    66             action = "update",
    67             params = { area_id = area.id },
    68             routing = {
    69               default = {
    70                 mode = "redirect",
    71                 module = request.get_module(),
    72                 view = request.get_view(),
    73                 id = param.get_id_cgi(),
    74                 params = param.get_all_cgi()
    75               }
    76             }
    77           }
    78         end
    80         if app.session.member_id == member.id and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    82           slot.put(" · ")
    83           if area.delegation_info.own_delegation_scope ~= "area" then
    84             ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
    85           else
    86             ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
    87           end
    88           slot.put(" · ")
    90           ui.link{
    91             content = function()
    92               slot.put(_"Create new issue")
    93             end,
    94             module = "initiative",
    95             view = "new",
    96             params = { area_id = area.id }
    97           }
    98         end
   100       end
   102     end }
   104   else
   105     slot.put("<br />")
   106   end
   108 end }
