annotate app/main/admin/unit_list.lua @ 581:c676054cb0bc
Some improvements to admin member section
author |
bsw |
date |
Wed Jun 20 13:31:09 2012 +0200 (2012-06-20) |
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 } |