annotate app/main/admin/unit_list.lua @ 533:c92e2f2dcc2e
merge
 | author | 
 bsw | 
 | date | 
 Mon May 21 21:30:58 2012 +0200 (2012-05-21) | 
 | parents | 
 dbfde3c56790  | 
 | children | 
 bc6934411019  | 
 
 | rev | 
   line source | 
| 
bsw@263
 | 
     1 local units = Unit:get_flattened_tree{ active = true }
 | 
| 
bsw@263
 | 
     2 
 | 
| 
bsw@263
 | 
     3 slot.put_into("title", _"Unit list")
 | 
| 
bsw@263
 | 
     4 
 | 
| 
bsw@263
 | 
     5 slot.select("actions", function()
 | 
| 
bsw@263
 | 
     6   ui.link{
 | 
| 
bsw@263
 | 
     7     attr = { class = { "admin_only" } },
 | 
| 
bsw@263
 | 
     8     text = _"Create new unit",
 | 
| 
bsw@263
 | 
     9     module = "admin",
 | 
| 
bsw@263
 | 
    10     view = "unit_edit"
 | 
| 
bsw@263
 | 
    11   }
 | 
| 
bsw@263
 | 
    12 end)
 | 
| 
bsw@263
 | 
    13  
 | 
| 
bsw@263
 | 
    14 ui.list{
 | 
| 
bsw@263
 | 
    15   records = units,
 | 
| 
bsw@263
 | 
    16   columns = {
 | 
| 
bsw@263
 | 
    17     {
 | 
| 
bsw@263
 | 
    18       label = "name",
 | 
| 
bsw@513
 | 
    19       name = "name"
 | 
| 
bsw@513
 | 
    20     },
 | 
| 
bsw@513
 | 
    21     {
 | 
| 
bsw@263
 | 
    22       content = function(unit)
 | 
| 
bsw@513
 | 
    23         ui.link{
 | 
| 
bsw@513
 | 
    24           attr = { class = "action admin_only" },
 | 
| 
bsw@513
 | 
    25           text = _"Edit unit",
 | 
| 
bsw@513
 | 
    26           module = "admin", view = "unit_edit", id = unit.id
 | 
| 
bsw@513
 | 
    27         }
 | 
| 
bsw@513
 | 
    28         ui.link{
 | 
| 
bsw@513
 | 
    29           attr = { class = "action admin_only" },
 | 
| 
bsw@513
 | 
    30           text = _"Edit areas",
 | 
| 
bsw@513
 | 
    31           module = "admin", view = "area_list", params = { unit_id = unit.id }
 | 
| 
bsw@513
 | 
    32         }
 | 
| 
bsw@263
 | 
    33       end 
 | 
| 
bsw@263
 | 
    34     }
 | 
| 
bsw@263
 | 
    35   }
 | 
| 
bsw@263
 | 
    36 } |