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@1045: ui.titleAdmin(_"Policy list") bsw@194: bsw@1045: ui.section( function() bsw@1045: ui.sectionHead( function() bsw@1045: ui.heading { level = 1, content = _"Policy list" } bsw@1045: end ) bsw@1045: bsw@1045: ui.sectionRow( function() bsw@194: bsw@1045: if show_not_in_use then bsw@1045: ui.link{ bsw@1045: text = _"Show policies in use", bsw@1045: module = "admin", bsw@1045: view = "policy_list" bsw@1045: } bsw@194: bsw@1045: else bsw@1045: ui.link{ bsw@1045: text = _"Create new policy", bsw@1045: module = "admin", bsw@1045: view = "policy_show" bsw@1045: } bsw@1045: slot.put(" · ") bsw@1045: ui.link{ bsw@1045: text = _"Show policies not in use", bsw@1045: module = "admin", bsw@1045: view = "policy_list", bsw@1045: params = { show_not_in_use = true } bsw@1045: } bsw@1045: bsw@1045: end bsw@1045: bsw@1045: end ) bsw@1045: bsw@1045: ui.sectionRow( function() bsw@1045: bsw@1045: ui.list{ bsw@1045: records = policies, bsw@1045: columns = { bsw@1045: bsw@1045: { content = function(record) bsw@1045: ui.link{ bsw@1045: text = record.name, bsw@1045: module = "admin", bsw@1045: view = "policy_show", bsw@1045: id = record.id bsw@1045: } bsw@1045: end bsw@1045: } bsw@1045: bsw@1045: } bsw@194: } bsw@194: bsw@1045: end ) bsw@1045: end )