bsw/jbe@0: local id = param.get_id() bsw/jbe@0: bsw/jbe@0: local area bsw/jbe@0: if id then bsw/jbe@0: area = Area:new_selector():add_where{ "id = ?", id }:single_object_mode():exec() bsw/jbe@0: end bsw/jbe@0: bsw/jbe@0: slot.put_into("title", _"Create new area") bsw/jbe@0: bsw/jbe@0: ui.form{ bsw/jbe@0: attr = { class = "vertical" }, bsw/jbe@0: record = area, bsw/jbe@5: module = "admin", bsw/jbe@5: action = "area_update", bsw/jbe@0: routing = { bsw/jbe@0: default = { bsw/jbe@0: mode = "redirect", bsw/jbe@0: module = "admin", bsw/jbe@0: view = "area_list" bsw/jbe@0: } bsw/jbe@0: }, bsw/jbe@0: id = area and area.id or nil, bsw/jbe@0: content = function() bsw/jbe@0: ui.field.text{ label = _"Name", name = "name" } bsw/jbe@0: ui.field.boolean{ label = _"Active?", name = "active" } bsw/jbe@0: ui.field.text{ label = _"Description", name = "description", multiline = true } poelzi@119: ui.multiselect{ label = _"Policies", name = "allowed_policies[]", poelzi@119: foreign_records = Policy:new_selector():add_where{ "active='t'"}:exec(), poelzi@119: foreign_id = "id", poelzi@119: foreign_name = "name", poelzi@119: connecting_records = area.allowed_policies, poelzi@119: foreign_reference = "id" } bsw/jbe@0: ui.submit{ text = _"Save" } bsw/jbe@0: end bsw/jbe@0: }