liquid_feedback_frontend
diff app/main/admin/policy_list.lua @ 194:c0292c3a70d8
Added policy editor to admin area
| author | bsw |
|---|---|
| date | Mon Nov 08 15:05:15 2010 +0100 (2010-11-08) |
| parents | |
| children | b5684668ac4b |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/admin/policy_list.lua Mon Nov 08 15:05:15 2010 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false 1.5 + 1.6 +local policies = Policy:build_selector{ active = not show_not_in_use }:exec() 1.7 + 1.8 + 1.9 +slot.put_into("title", _"Policy list") 1.10 + 1.11 + 1.12 +slot.select("actions", function() 1.13 + 1.14 + if show_not_in_use then 1.15 + ui.link{ 1.16 + attr = { class = { "admin_only" } }, 1.17 + text = _"Show policies in use", 1.18 + module = "admin", 1.19 + view = "policy_list" 1.20 + } 1.21 + 1.22 + else 1.23 + ui.link{ 1.24 + attr = { class = { "admin_only" } }, 1.25 + text = _"Create new policy", 1.26 + module = "admin", 1.27 + view = "policy_show" 1.28 + } 1.29 + ui.link{ 1.30 + attr = { class = { "admin_only" } }, 1.31 + text = _"Show policies not in use", 1.32 + module = "admin", 1.33 + view = "policy_list", 1.34 + params = { show_not_in_use = true } 1.35 + } 1.36 + 1.37 + end 1.38 + 1.39 +end) 1.40 + 1.41 + 1.42 +ui.list{ 1.43 + records = policies, 1.44 + columns = { 1.45 + 1.46 + { label = _"Policy", name = "name" }, 1.47 + 1.48 + { content = function(record) 1.49 + ui.link{ 1.50 + attr = { class = { "action admin_only" } }, 1.51 + text = _"Edit", 1.52 + module = "admin", 1.53 + view = "policy_show", 1.54 + id = record.id 1.55 + } 1.56 + end 1.57 + } 1.58 + 1.59 + } 1.60 +} 1.61 \ No newline at end of file