liquid_feedback_frontend
view app/main/admin/area_list.lua @ 253:524b46066028
Unlock all extended accordion view
| author | Ingo Bormuth <mail@ibormuth.de> | 
|---|---|
| date | Fri Dec 30 04:04:06 2011 +0100 (2011-12-30) | 
| parents | 46351752814f | 
| children | f42d16567c5d | 
 line source
     1 local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false
     3 local areas = Area:build_selector{ active = not show_not_in_use }:exec()
     6 slot.put_into("title", _"Area list")
     9 slot.select("actions", function()
    11   if show_not_in_use then
    12     ui.link{
    13       attr = { class = { "admin_only" } },
    14       text = _"Show areas in use",
    15       module = "admin",
    16       view = "area_list"
    17     }
    19   else
    20     ui.link{
    21       attr = { class = { "admin_only" } },
    22       text = _"Create new area",
    23       module = "admin",
    24       view = "area_show"
    25     }
    26     ui.link{
    27       attr = { class = { "admin_only" } },
    28       text = _"Show areas not in use",
    29       module = "admin",
    30       view = "area_list",
    31       params = { show_not_in_use = true }
    32     }
    33   end
    35 end)
    38 ui.list{
    39   records = areas,
    40   columns = {
    42     { label = _"Area", name = "name" },
    44     { content = function(record)
    45         if app.session.member.admin then
    46           ui.link{
    47             attr = { class = { "action admin_only" } },
    48             text = _"Edit",
    49             module = "admin",
    50             view = "area_show",
    51             id = record.id
    52           }
    53         end
    54       end
    55     }
    57   }
    58 }
