liquid_feedback_frontend
view app/main/area/show.lua @ 281:b77e6a17ca77
Check unit voting right where neccessary, hide action buttons for units without voting right
| author | bsw | 
|---|---|
| date | Thu Feb 16 15:01:49 2012 +0100 (2012-02-16) | 
| parents | bde068b37608 | 
| children | 6c88b4bfb56c | 
 line source
     1 local area = Area:by_id(param.get_id())
     4 app.html_title.title = area.name
     5 app.html_title.subtitle = _("Area")
     7 util.help("area.show")
    10 if config.feature_rss_enabled then
    11   util.html_rss_head{ title = _"Initiatives in this area (last created first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
    12   util.html_rss_head{ title = _"Initiatives in this area (last updated first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
    13 end
    16 slot.select("title", function()
    17   ui.tag{ content =  area.name }
    19   if not config.single_unit_id then
    20     slot.put(" · ")
    21     ui.link{
    22       content = area.unit.name,
    23       module = "area",
    24       view = "list",
    25       params = { unit_id = area.unit_id }
    26     }
    27   end
    30 end)
    32 ui.container{
    33   attr = { class = "vertical"},
    34   content = function()
    35     ui.field.text{ value = area.description }
    36   end
    37 }
    40 if app.session.member_id then
    41   execute.view{
    42     module = "membership",
    43     view = "_show_box",
    44     params = { area = area }
    45   }
    47   execute.view{
    48     module = "delegation",
    49     view = "_show_box",
    50     params = { area_id = area.id }
    51   }
    53   if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    54     slot.select("actions", function()
    55       ui.link{
    56         content = function()
    57           ui.image{ static = "icons/16/folder_add.png" }
    58           slot.put(_"Create new issue")
    59         end,
    60         module = "initiative",
    61         view = "new",
    62         params = { area_id = area.id }
    63       }
    64     end)
    65   end
    68 end
    70 if app.session.member then
    71   execute.view{
    72     module = "area",
    73     view = "show_tab",
    74     params = { area = area }
    75   }
    76 else
    77   execute.view{
    78     module = "issue",
    79     view = "_list",
    80     params = {
    81       issues_selector = area:get_reference_selector("issues"),
    82       filter = cgi.params["filter"],
    83       filter_voting = param.get("filter_voting"),
    84       for_area_list = true
    85     }
    86   }
    87 end
