bsw@193: local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false bsw/jbe@0: bsw@193: local areas = Area:build_selector{ active = not show_not_in_use }:exec() bsw/jbe@0: bsw/jbe@0: bsw/jbe@0: slot.put_into("title", _"Area list") bsw/jbe@0: bsw@193: bsw@193: slot.select("actions", function() bsw@193: bsw@193: if show_not_in_use then bsw@193: ui.link{ bsw@193: attr = { class = { "admin_only" } }, bsw@193: text = _"Show areas in use", bsw@193: module = "admin", bsw@193: view = "area_list" bsw@193: } bsw@193: bsw@193: else bsw@193: ui.link{ bsw@193: attr = { class = { "admin_only" } }, bsw@193: text = _"Create new area", bsw@193: module = "admin", bsw@193: view = "area_show" bsw@193: } bsw@193: ui.link{ bsw@193: attr = { class = { "admin_only" } }, bsw@193: text = _"Show areas not in use", bsw@193: module = "admin", bsw@193: view = "area_list", bsw@193: params = { show_not_in_use = true } bsw@193: } bsw@193: end bsw@193: bsw@193: end) bsw@193: bsw/jbe@0: bsw/jbe@0: ui.list{ bsw/jbe@0: records = areas, bsw/jbe@0: columns = { bsw@193: bsw@193: { label = _"Area", name = "name" }, bsw@193: bsw@193: { content = function(record) bsw/jbe@0: if app.session.member.admin then bsw/jbe@0: ui.link{ bsw/jbe@0: attr = { class = { "action admin_only" } }, bsw/jbe@0: text = _"Edit", bsw/jbe@0: module = "admin", bsw/jbe@0: view = "area_show", bsw/jbe@0: id = record.id bsw/jbe@0: } bsw/jbe@0: end bsw/jbe@0: end bsw/jbe@0: } bsw@193: bsw/jbe@0: } bsw/jbe@0: }