| rev | 
   line source | 
| 
bsw@525
 | 
     1 local area = param.get("area", "table")
 | 
| 
bsw@525
 | 
     2 
 | 
| 
bsw@529
 | 
     3 local show_content = param.get("show_content", atom.boolean)
 | 
| 
bsw@529
 | 
     4 
 | 
| 
bsw@529
 | 
     5 area:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@529
 | 
     6 
 | 
| 
bsw@619
 | 
     7 if not param.get("hide_unit", atom.boolean) then
 | 
| 
bsw@619
 | 
     8   execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
 | 
| 
bsw@619
 | 
     9 end
 | 
| 
bsw@525
 | 
    10 
 | 
| 
bsw@526
 | 
    11 ui.container{ attr = { class = "area_head" }, content = function()
 | 
| 
bsw@525
 | 
    12 
 | 
| 
bsw@526
 | 
    13   execute.view{ module = "delegation", view = "_info", params = { area = area } }
 | 
| 
bsw@525
 | 
    14 
 | 
| 
bsw@526
 | 
    15   ui.container{ attr = { class = "title" }, content = function()
 | 
| 
bsw@526
 | 
    16     -- area name
 | 
| 
bsw@526
 | 
    17     ui.link{
 | 
| 
bsw@526
 | 
    18       module = "area", view = "show", id = area.id,
 | 
| 
bsw@526
 | 
    19       attr = { class = "area_name" }, content = area.name 
 | 
| 
bsw@526
 | 
    20     }
 | 
| 
bsw@526
 | 
    21   end }
 | 
| 
bsw@526
 | 
    22   
 | 
| 
bsw@529
 | 
    23   if show_content then
 | 
| 
bsw@529
 | 
    24     
 | 
| 
bsw@529
 | 
    25     ui.container{ attr = { class = "content" }, content = function()
 | 
| 
bsw@525
 | 
    26 
 | 
| 
bsw@529
 | 
    27       -- actions (members with appropriate voting right only)
 | 
| 
bsw@529
 | 
    28       if app.session.member_id then
 | 
| 
bsw@525
 | 
    29 
 | 
| 
bsw@529
 | 
    30         -- membership
 | 
| 
bsw@529
 | 
    31         local membership = Membership:by_pk(area.id, app.session.member.id)
 | 
| 
bsw@525
 | 
    32 
 | 
| 
bsw@529
 | 
    33         if membership then
 | 
| 
bsw@529
 | 
    34           
 | 
| 
bsw@529
 | 
    35           ui.tag{ content = _"You are participating in this area" }
 | 
| 
bsw@529
 | 
    36           
 | 
| 
bsw@529
 | 
    37           slot.put(" ")
 | 
| 
bsw@529
 | 
    38           
 | 
| 
bsw@529
 | 
    39           ui.tag{ content = function()
 | 
| 
bsw@529
 | 
    40             slot.put("(")
 | 
| 
bsw@529
 | 
    41             ui.link{
 | 
| 
bsw@529
 | 
    42               text    = _"Withdraw",
 | 
| 
bsw@529
 | 
    43               module  = "membership",
 | 
| 
bsw@529
 | 
    44               action  = "update",
 | 
| 
bsw@529
 | 
    45               params  = { area_id = area.id, delete = true },
 | 
| 
bsw@529
 | 
    46               routing = {
 | 
| 
bsw@529
 | 
    47                 default = {
 | 
| 
bsw@529
 | 
    48                   mode = "redirect",
 | 
| 
bsw@529
 | 
    49                   module = request.get_module(),
 | 
| 
bsw@529
 | 
    50                   view = request.get_view(),
 | 
| 
bsw@529
 | 
    51                   id = param.get_id_cgi(),
 | 
| 
bsw@529
 | 
    52                   params = param.get_all_cgi()
 | 
| 
bsw@529
 | 
    53                 }
 | 
| 
bsw@529
 | 
    54               }
 | 
| 
bsw@529
 | 
    55             }
 | 
| 
bsw@529
 | 
    56             slot.put(")")
 | 
| 
bsw@529
 | 
    57           end }
 | 
| 
bsw@529
 | 
    58           
 | 
| 
bsw@529
 | 
    59 
 | 
| 
bsw@529
 | 
    60         elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
 | 
| 
bsw@526
 | 
    61           ui.link{
 | 
| 
bsw@529
 | 
    62             text   = _"Participate in this area",
 | 
| 
bsw@529
 | 
    63             module = "membership",
 | 
| 
bsw@529
 | 
    64             action = "update",
 | 
| 
bsw@529
 | 
    65             params = { area_id = area.id },
 | 
| 
bsw@528
 | 
    66             routing = {
 | 
| 
bsw@528
 | 
    67               default = {
 | 
| 
bsw@528
 | 
    68                 mode = "redirect",
 | 
| 
bsw@528
 | 
    69                 module = request.get_module(),
 | 
| 
bsw@528
 | 
    70                 view = request.get_view(),
 | 
| 
bsw@528
 | 
    71                 id = param.get_id_cgi(),
 | 
| 
bsw@528
 | 
    72                 params = param.get_all_cgi()
 | 
| 
bsw@528
 | 
    73               }
 | 
| 
bsw@528
 | 
    74             }
 | 
| 
bsw@526
 | 
    75           }
 | 
| 
bsw@529
 | 
    76         end
 | 
| 
bsw@622
 | 
    77         
 | 
| 
bsw@622
 | 
    78         if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
 | 
| 
bsw@529
 | 
    79 
 | 
| 
bsw@622
 | 
    80           slot.put(" · ")
 | 
| 
bsw@622
 | 
    81           if area.delegation_info.own_delegation_scope ~= "area" then
 | 
| 
bsw@622
 | 
    82             ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
 | 
| 
bsw@622
 | 
    83           else
 | 
| 
bsw@622
 | 
    84             ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
 | 
| 
bsw@622
 | 
    85           end
 | 
| 
bsw@622
 | 
    86           slot.put(" · ")
 | 
| 
bsw@525
 | 
    87 
 | 
| 
bsw@529
 | 
    88           ui.link{
 | 
| 
bsw@529
 | 
    89             content = function()
 | 
| 
bsw@529
 | 
    90               slot.put(_"Create new issue")
 | 
| 
bsw@529
 | 
    91             end,
 | 
| 
bsw@529
 | 
    92             module = "initiative",
 | 
| 
bsw@529
 | 
    93             view = "new",
 | 
| 
bsw@529
 | 
    94             params = { area_id = area.id }
 | 
| 
bsw@525
 | 
    95           }
 | 
| 
bsw@529
 | 
    96         end
 | 
| 
bsw@525
 | 
    97 
 | 
| 
bsw@525
 | 
    98       end
 | 
| 
bsw@525
 | 
    99 
 | 
| 
bsw@529
 | 
   100     end }
 | 
| 
bsw@526
 | 
   101 
 | 
| 
bsw@529
 | 
   102   else
 | 
| 
bsw@529
 | 
   103     slot.put("<br />")
 | 
| 
bsw@529
 | 
   104   end
 | 
| 
bsw@526
 | 
   105 
 | 
| 
bsw@526
 | 
   106 end } |