bsw@263: local units = Unit:get_flattened_tree{ active = true } bsw@263: bsw@263: slot.put_into("title", _"Unit list") bsw@263: bsw@263: slot.select("actions", function() bsw@263: ui.link{ bsw@263: attr = { class = { "admin_only" } }, bsw@263: text = _"Create new unit", bsw@263: module = "admin", bsw@263: view = "unit_edit" bsw@263: } bsw@263: end) bsw@263: bsw@263: ui.list{ bsw@263: records = units, bsw@263: columns = { bsw@263: { bsw@263: label = "name", bsw@513: name = "name" bsw@513: }, bsw@513: { bsw@263: content = function(unit) bsw@513: ui.link{ bsw@513: attr = { class = "action admin_only" }, bsw@513: text = _"Edit unit", bsw@513: module = "admin", view = "unit_edit", id = unit.id bsw@513: } bsw@513: ui.link{ bsw@513: attr = { class = "action admin_only" }, bsw@513: text = _"Edit areas", bsw@513: module = "admin", view = "area_list", params = { unit_id = unit.id } bsw@513: } bsw@263: end bsw@263: } bsw@263: } bsw@263: }