annotate app/main/area/list.lua @ 249:52b125fada5b
Show unit delegation button only for logged in users
 | author | 
 bsw | 
 | date | 
 Fri Dec 30 03:14:51 2011 +0100 (2011-12-30) | 
 | parents | 
 e3613831cd1e  | 
 | children | 
 743194cbdd89  | 
 
 | rev | 
   line source | 
| 
bsw@241
 | 
     1 -- TODO support multiple units
 | 
| 
bsw@241
 | 
     2 local unit_id = param.get("units", atom.integer)
 | 
| 
bsw@241
 | 
     3 local areas_selector = Area:build_selector{ active = true, unit_id = unit_id }
 | 
| 
bsw@197
 | 
     4 
 | 
| 
bsw@247
 | 
     5 local unit = Unit:by_id(unit_id)
 | 
| 
bsw@247
 | 
     6 
 | 
| 
bsw@197
 | 
     7 
 | 
| 
bsw@51
 | 
     8 if app.session.member_id then
 | 
| 
bsw@247
 | 
     9   slot.put_into("title", _("Area list of unit '#{unit_name}'", { unit_name = unit.name }))
 | 
| 
bsw@51
 | 
    10 else
 | 
| 
bsw@51
 | 
    11   slot.put_into("title", encode.html(config.app_title))
 | 
| 
bsw@51
 | 
    12 end
 | 
| 
bsw@51
 | 
    13 
 | 
| 
bsw@197
 | 
    14 
 | 
| 
bsw@69
 | 
    15 if not app.session.member_id and config.motd_public then
 | 
| 
bsw@69
 | 
    16   local help_text = config.motd_public
 | 
| 
bsw@69
 | 
    17   ui.container{
 | 
| 
bsw@69
 | 
    18     attr = { class = "wiki motd" },
 | 
| 
bsw@69
 | 
    19     content = function()
 | 
| 
bsw@69
 | 
    20       slot.put(format.wiki_text(help_text))
 | 
| 
bsw@69
 | 
    21     end
 | 
| 
bsw@69
 | 
    22   }
 | 
| 
bsw@51
 | 
    23 end
 | 
| 
bsw/jbe@0
 | 
    24 
 | 
| 
bsw/jbe@4
 | 
    25 util.help("area.list", _"Area list")
 | 
| 
bsw/jbe@4
 | 
    26 
 | 
| 
bsw@249
 | 
    27 if app.session.member_id then
 | 
| 
bsw@249
 | 
    28   execute.view{
 | 
| 
bsw@249
 | 
    29     module = "delegation",
 | 
| 
bsw@249
 | 
    30     view = "_show_box",
 | 
| 
bsw@249
 | 
    31     params = { unit_id = unit_id }
 | 
| 
bsw@249
 | 
    32   }
 | 
| 
bsw@249
 | 
    33 end
 | 
| 
bsw@248
 | 
    34 
 | 
| 
bsw/jbe@0
 | 
    35 
 | 
| 
bsw/jbe@0
 | 
    36 execute.view{
 | 
| 
bsw/jbe@0
 | 
    37   module = "area",
 | 
| 
bsw/jbe@0
 | 
    38   view = "_list",
 | 
| 
bsw/jbe@0
 | 
    39   params = { areas_selector = areas_selector }
 | 
| 
bsw/jbe@0
 | 
    40 }
 |