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