annotate app/main/unit/_list.lua @ 1608:89818dc70cb6
Updated license file
 | author | 
 bsw | 
 | date | 
 Mon Feb 01 21:32:03 2021 +0100 (2021-02-01) | 
 | parents | 
 2a0d86117d54  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw@1045
 | 
     1 local for_admin = param.get("for_admin", atom.boolean)
 | 
| 
bsw@1504
 | 
     2 local units = Unit:get_flattened_tree{}
 | 
| 
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@1433
 | 
    18             ui.link{ text = unit.name, module = "index", view = "index", params = { unit = unit.id } }
 | 
| 
bsw@1045
 | 
    19           end
 | 
| 
bsw@462
 | 
    20         end 
 | 
| 
bsw@462
 | 
    21       }
 | 
| 
bsw@276
 | 
    22     }
 | 
| 
bsw@276
 | 
    23   }
 | 
| 
bsw@462
 | 
    24   
 | 
| 
bsw@1433
 | 
    25 end }
 |