bsw@194: local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false bsw@194: bsw@194: local policies = Policy:build_selector{ active = not show_not_in_use }:exec() bsw@194: bsw@194: bsw@603: ui.title(_"Policy list") bsw@194: bsw@194: bsw@603: ui.actions(function() bsw@194: bsw@194: if show_not_in_use then bsw@194: ui.link{ bsw@194: text = _"Show policies in use", bsw@194: module = "admin", bsw@194: view = "policy_list" bsw@194: } bsw@194: bsw@194: else bsw@194: ui.link{ bsw@194: text = _"Create new policy", bsw@194: module = "admin", bsw@194: view = "policy_show" bsw@194: } bsw@603: slot.put(" · ") bsw@194: ui.link{ bsw@194: text = _"Show policies not in use", bsw@194: module = "admin", bsw@194: view = "policy_list", bsw@194: params = { show_not_in_use = true } bsw@194: } bsw@194: bsw@194: end bsw@194: bsw@194: end) bsw@194: bsw@194: bsw@194: ui.list{ bsw@194: records = policies, bsw@194: columns = { bsw@194: bsw@194: { label = _"Policy", name = "name" }, bsw@194: bsw@194: { content = function(record) bsw@194: ui.link{ bsw@194: text = _"Edit", bsw@194: module = "admin", bsw@194: view = "policy_show", bsw@194: id = record.id bsw@194: } bsw@194: end bsw@194: } bsw@194: bsw@194: } bsw@194: }