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