liquid_feedback_frontend
view app/main/admin/area_list.lua @ 1145:904f6807f7fa
Added support for upcoming moonbridge bases WebMCP
| author | bsw | 
|---|---|
| date | Sat Mar 21 15:26:39 2015 +0100 (2015-03-21) | 
| parents | bc6934411019 | 
| children | 
 line source
     1 local unit_id = param.get("unit_id", atom.integer)
     2 local unit = Unit:by_id(unit_id)
     4 local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false
     6 local areas = Area:build_selector{ unit_id = unit_id, active = not show_not_in_use }:exec()
     9 ui.title(_("Area list of '#{unit_name}'", { unit_name = unit.name }))
    12 ui.actions(function()
    14   if show_not_in_use then
    15     ui.link{
    16       text = _"Show areas in use",
    17       module = "admin",
    18       view = "area_list",
    19       params = { unit_id = unit_id }
    20     }
    22   else
    23     ui.link{
    24       text = _"Create new area",
    25       module = "admin",
    26       view = "area_show",
    27       params = { unit_id = unit_id }
    28     }
    30     slot.put(" · ")
    32     ui.link{
    33       text = _"Show areas not in use",
    34       module = "admin",
    35       view = "area_list",
    36       params = { show_not_in_use = true, unit_id = unit_id }
    37     }
    38   end
    40 end)
    43 ui.list{
    44   records = areas,
    45   columns = {
    47     { label = _"Area", name = "name" },
    49     { content = function(record)
    50         if app.session.member.admin then
    51           ui.link{
    52             attr = { class = { "action admin_only" } },
    53             text = _"Edit",
    54             module = "admin",
    55             view = "area_show",
    56             id = record.id
    57           }
    58         end
    59       end
    60     }
    62   }
    63 }
