annotate app/main/admin/policy_list.lua @ 959:1d9e48ecd254
Ordering of suggestions by harmonic weight
author |
bsw |
date |
Sat Feb 02 22:16:10 2013 +0100 (2013-02-02) |
parents |
b5684668ac4b |
children |
701a5cf6b067 |
rev |
line source |
bsw@194
|
1 local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false
|
bsw@194
|
2
|
bsw@194
|
3 local policies = Policy:build_selector{ active = not show_not_in_use }:exec()
|
bsw@194
|
4
|
bsw@194
|
5
|
bsw@603
|
6 ui.title(_"Policy list")
|
bsw@194
|
7
|
bsw@194
|
8
|
bsw@603
|
9 ui.actions(function()
|
bsw@194
|
10
|
bsw@194
|
11 if show_not_in_use then
|
bsw@194
|
12 ui.link{
|
bsw@194
|
13 text = _"Show policies in use",
|
bsw@194
|
14 module = "admin",
|
bsw@194
|
15 view = "policy_list"
|
bsw@194
|
16 }
|
bsw@194
|
17
|
bsw@194
|
18 else
|
bsw@194
|
19 ui.link{
|
bsw@194
|
20 text = _"Create new policy",
|
bsw@194
|
21 module = "admin",
|
bsw@194
|
22 view = "policy_show"
|
bsw@194
|
23 }
|
bsw@603
|
24 slot.put(" · ")
|
bsw@194
|
25 ui.link{
|
bsw@194
|
26 text = _"Show policies not in use",
|
bsw@194
|
27 module = "admin",
|
bsw@194
|
28 view = "policy_list",
|
bsw@194
|
29 params = { show_not_in_use = true }
|
bsw@194
|
30 }
|
bsw@194
|
31
|
bsw@194
|
32 end
|
bsw@194
|
33
|
bsw@194
|
34 end)
|
bsw@194
|
35
|
bsw@194
|
36
|
bsw@194
|
37 ui.list{
|
bsw@194
|
38 records = policies,
|
bsw@194
|
39 columns = {
|
bsw@194
|
40
|
bsw@194
|
41 { label = _"Policy", name = "name" },
|
bsw@194
|
42
|
bsw@194
|
43 { content = function(record)
|
bsw@194
|
44 ui.link{
|
bsw@194
|
45 text = _"Edit",
|
bsw@194
|
46 module = "admin",
|
bsw@194
|
47 view = "policy_show",
|
bsw@194
|
48 id = record.id
|
bsw@194
|
49 }
|
bsw@194
|
50 end
|
bsw@194
|
51 }
|
bsw@194
|
52
|
bsw@194
|
53 }
|
bsw@194
|
54 } |