liquid_feedback_frontend
view app/main/admin/area_list.lua @ 551:c1dc3b14a4f3
Initiative and initiative member_info preloading
| author | bsw | 
|---|---|
| date | Fri Jun 15 19:00:43 2012 +0200 (2012-06-15) | 
| parents | f42d16567c5d | 
| children | bc6934411019 | 
 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 slot.put_into("title", _("Area list of '#{unit_name}'", { unit_name = unit.name}))
    12 slot.select("actions", function()
    14   ui.link{
    15     attr = { class = { "admin_only" } },
    16     text = _"Back to unit list",
    17     module = "admin",
    18     view = "unit_list"
    19   }
    21   if show_not_in_use then
    22     ui.link{
    23       attr = { class = { "admin_only" } },
    24       text = _"Show areas in use",
    25       module = "admin",
    26       view = "area_list",
    27       params = { unit_id = unit_id }
    28     }
    30   else
    31     ui.link{
    32       attr = { class = { "admin_only" } },
    33       text = _"Create new area",
    34       module = "admin",
    35       view = "area_show",
    36       params = { unit_id = unit_id }
    37     }
    38     ui.link{
    39       attr = { class = { "admin_only" } },
    40       text = _"Show areas not in use",
    41       module = "admin",
    42       view = "area_list",
    43       params = { show_not_in_use = true, unit_id = unit_id }
    44     }
    45   end
    47 end)
    50 ui.list{
    51   records = areas,
    52   columns = {
    54     { label = _"Area", name = "name" },
    56     { content = function(record)
    57         if app.session.member.admin then
    58           ui.link{
    59             attr = { class = { "action admin_only" } },
    60             text = _"Edit",
    61             module = "admin",
    62             view = "area_show",
    63             id = record.id
    64           }
    65         end
    66       end
    67     }
    69   }
    70 }
