annotate app/main/admin/area_list.lua @ 300:cb9ccdd024f2
Do not check voting rights for virtual delegation target 'abandon'
author |
bsw |
date |
Sat Feb 25 22:29:33 2012 +0100 (2012-02-25) |
parents |
f42d16567c5d |
children |
bc6934411019 |
rev |
line source |
bsw@263
|
1 local unit_id = param.get("unit_id", atom.integer)
|
bsw@263
|
2 local unit = Unit:by_id(unit_id)
|
bsw@263
|
3
|
bsw@193
|
4 local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false
|
bsw/jbe@0
|
5
|
bsw@263
|
6 local areas = Area:build_selector{ unit_id = unit_id, active = not show_not_in_use }:exec()
|
bsw/jbe@0
|
7
|
bsw/jbe@0
|
8
|
bsw@263
|
9 slot.put_into("title", _("Area list of '#{unit_name}'", { unit_name = unit.name}))
|
bsw/jbe@0
|
10
|
bsw@193
|
11
|
bsw@193
|
12 slot.select("actions", function()
|
bsw@193
|
13
|
bsw@263
|
14 ui.link{
|
bsw@263
|
15 attr = { class = { "admin_only" } },
|
bsw@263
|
16 text = _"Back to unit list",
|
bsw@263
|
17 module = "admin",
|
bsw@263
|
18 view = "unit_list"
|
bsw@263
|
19 }
|
bsw@263
|
20
|
bsw@193
|
21 if show_not_in_use then
|
bsw@193
|
22 ui.link{
|
bsw@193
|
23 attr = { class = { "admin_only" } },
|
bsw@193
|
24 text = _"Show areas in use",
|
bsw@193
|
25 module = "admin",
|
bsw@263
|
26 view = "area_list",
|
bsw@263
|
27 params = { unit_id = unit_id }
|
bsw@193
|
28 }
|
bsw@193
|
29
|
bsw@193
|
30 else
|
bsw@193
|
31 ui.link{
|
bsw@193
|
32 attr = { class = { "admin_only" } },
|
bsw@193
|
33 text = _"Create new area",
|
bsw@193
|
34 module = "admin",
|
bsw@263
|
35 view = "area_show",
|
bsw@263
|
36 params = { unit_id = unit_id }
|
bsw@193
|
37 }
|
bsw@193
|
38 ui.link{
|
bsw@193
|
39 attr = { class = { "admin_only" } },
|
bsw@193
|
40 text = _"Show areas not in use",
|
bsw@193
|
41 module = "admin",
|
bsw@193
|
42 view = "area_list",
|
bsw@263
|
43 params = { show_not_in_use = true, unit_id = unit_id }
|
bsw@193
|
44 }
|
bsw@193
|
45 end
|
bsw@193
|
46
|
bsw@193
|
47 end)
|
bsw@193
|
48
|
bsw/jbe@0
|
49
|
bsw/jbe@0
|
50 ui.list{
|
bsw/jbe@0
|
51 records = areas,
|
bsw/jbe@0
|
52 columns = {
|
bsw@193
|
53
|
bsw@193
|
54 { label = _"Area", name = "name" },
|
bsw@193
|
55
|
bsw@193
|
56 { content = function(record)
|
bsw/jbe@0
|
57 if app.session.member.admin then
|
bsw/jbe@0
|
58 ui.link{
|
bsw/jbe@0
|
59 attr = { class = { "action admin_only" } },
|
bsw/jbe@0
|
60 text = _"Edit",
|
bsw/jbe@0
|
61 module = "admin",
|
bsw/jbe@0
|
62 view = "area_show",
|
bsw/jbe@0
|
63 id = record.id
|
bsw/jbe@0
|
64 }
|
bsw/jbe@0
|
65 end
|
bsw/jbe@0
|
66 end
|
bsw/jbe@0
|
67 }
|
bsw@193
|
68
|
bsw/jbe@0
|
69 }
|
bsw/jbe@0
|
70 } |