annotate app/main/unit/_list.lua @ 1204:6f2c0eb25773
merge
 | author | 
 jbe | 
 | date | 
 Sun Jul 12 20:49:47 2015 +0200 (2015-07-12) | 
 | parents | 
 701a5cf6b067  | 
 | children | 
 c18bee9e186e  | 
 
 | rev | 
   line source | 
| 
bsw@1045
 | 
     1 local for_admin = param.get("for_admin", atom.boolean)
 | 
| 
bsw@276
 | 
     2 local units = Unit:get_flattened_tree{ active = true }
 | 
| 
bsw@276
 | 
     3 
 | 
| 
bsw@462
 | 
     4 ui.container{ attr = { class = "box" }, content = function()
 | 
| 
bsw@462
 | 
     5 
 | 
| 
bsw@462
 | 
     6   ui.list{
 | 
| 
bsw@462
 | 
     7     attr = { class = "unit_list" },
 | 
| 
bsw@462
 | 
     8     records = units,
 | 
| 
bsw@462
 | 
     9     columns = {
 | 
| 
bsw@462
 | 
    10       {
 | 
| 
bsw@462
 | 
    11         content = function(unit)
 | 
| 
bsw@462
 | 
    12           for i = 1, unit.depth - 1 do
 | 
| 
bsw@462
 | 
    13             slot.put("     ")
 | 
| 
bsw@462
 | 
    14           end
 | 
| 
bsw@1045
 | 
    15           if for_admin then
 | 
| 
bsw@1045
 | 
    16             ui.link{ text = unit.name, module = "admin", view = "unit_edit", id = unit.id }
 | 
| 
bsw@1045
 | 
    17           else
 | 
| 
bsw@1045
 | 
    18             ui.link{ text = unit.name, module = "unit", view = "show", id = unit.id }
 | 
| 
bsw@1045
 | 
    19           end
 | 
| 
bsw@462
 | 
    20         end 
 | 
| 
bsw@462
 | 
    21       }
 | 
| 
bsw@276
 | 
    22     }
 | 
| 
bsw@276
 | 
    23   }
 | 
| 
bsw@462
 | 
    24   
 | 
| 
bsw@462
 | 
    25 end } |