liquid_feedback_frontend
view app/main/area/_head.lua @ 526:18cd8595459b
Fixes for public access
| author | bsw | 
|---|---|
| date | Fri May 18 19:21:45 2012 +0200 (2012-05-18) | 
| parents | 63d6549cc00b | 
| children | 305329da1c75 | 
 line source
     1 local area = param.get("area", "table")
     3 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
     5 ui.container{ attr = { class = "area_head" }, content = function()
     7   execute.view{ module = "delegation", view = "_info", params = { area = area } }
     9   ui.container{ attr = { class = "title" }, content = function()
    10     -- area name
    11     ui.link{
    12       module = "area", view = "show", id = area.id,
    13       attr = { class = "area_name" }, content = area.name 
    14     }
    15   end }
    17   ui.container{ attr = { class = "content" }, content = function()
    19     -- actions (members with appropriate voting right only)
    20     if app.session.member_id then
    22       -- membership
    23       local membership = Membership:by_pk(area.id, app.session.member.id)
    25       if membership then
    27         ui.tag{ content = _"You are member" }
    29         slot.put(" ")
    31         ui.tag{ content = function()
    32           slot.put("(")
    33           ui.link{
    34             text    = _"Withdraw",
    35             module  = "membership",
    36             action  = "update",
    37             params  = { area_id = area.id, delete = true },
    38             routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } }
    39           }
    40           slot.put(")")
    41         end }
    43         slot.put(" · ")
    45       elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    46         ui.link{
    47           text   = _"Become a member",
    48           module = "membership",
    49           action = "update",
    50           params = { area_id = area.id },
    51           routing = {
    52             default = {
    53               mode = "redirect",
    54               module = "area",
    55               view = "show",
    56               id = area.id
    57             }
    58           }
    59         }
    61         slot.put(" · ")
    63       end
    65       -- create new issue
    66       if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    67         ui.link{
    68           content = function()
    69             slot.put(_"Create new issue")
    70           end,
    71           module = "initiative",
    72           view = "new",
    73           params = { area_id = area.id }
    74         }
    75       end
    77     end
    79   end }
    81 end }
