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@1462: ui.grid{ content = function() bsw@194: bsw@1462: ui.cell_main{ content = function() bsw@1462: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1462: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1462: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Policy list" } bsw@1462: end } bsw@1462: ui.container{ attr = { class = "mdl-card__content" }, content = function() bsw@1462: bsw@1462: if show_not_in_use then bsw@1462: ui.link{ bsw@1462: text = _"Show policies in use", bsw@1462: module = "admin", bsw@1462: view = "policy_list" bsw@1462: } bsw@194: bsw@1462: else bsw@1462: ui.link{ bsw@1462: text = _"Create new policy", bsw@1462: module = "admin", bsw@1462: view = "policy_show" bsw@1462: } bsw@1462: slot.put(" · ") bsw@1462: ui.link{ bsw@1462: text = _"Show policies not in use", bsw@1462: module = "admin", bsw@1462: view = "policy_list", bsw@1462: params = { show_not_in_use = true } bsw@1462: } bsw@1045: bsw@1462: end bsw@1045: bsw@1462: ui.list{ bsw@1462: records = policies, bsw@1462: columns = { bsw@1045: bsw@1462: { content = function(record) bsw@1462: ui.link{ bsw@1462: text = record.name, bsw@1462: module = "admin", bsw@1462: view = "policy_show", bsw@1462: id = record.id bsw@1462: } bsw@1462: end bsw@1045: } bsw@1462: bsw@1462: } bsw@1045: } bsw@1462: end } bsw@1462: end } bsw@1462: end } bsw@1462: end }