bsw@10: local initiative = Initiative:by_id(param.get("initiative_id")) bsw@10: bsw@10: slot.put_into("title", _"Invite an initiator to initiative") bsw@10: bsw@10: slot.select("actions", function() bsw@10: ui.link{ bsw@10: content = function() bsw@10: ui.image{ static = "icons/16/cancel.png" } bsw@10: slot.put(_"Cancel") bsw@10: end, bsw@10: module = "initiative", bsw@10: view = "show", bsw@10: id = initiative.id, bsw@10: params = { bsw@10: tab = "initiators" bsw@10: } bsw@10: } bsw@10: end) bsw@10: bsw@10: util.help("initiative.add_initiator", _"Invite an initiator to initiative") bsw@10: bsw@10: ui.form{ bsw@10: attr = { class = "vertical" }, bsw@10: module = "initiative", bsw@10: action = "add_initiator", bsw@10: params = { bsw@10: initiative_id = initiative.id, bsw@10: }, bsw@10: routing = { bsw@10: ok = { bsw@10: mode = "redirect", bsw@10: module = "initiative", bsw@10: view = "show", bsw@10: id = initiative.id, bsw@10: params = { bsw@10: tab = "initiators", bsw@10: } bsw@10: } bsw@10: }, bsw@10: content = function() bsw@10: local records = { bsw@10: { bsw@10: id = "-1", bsw@10: name = _"Choose member" bsw@10: } bsw@10: } bsw@10: local contact_members = app.session.member:get_reference_selector("saved_members"):add_order_by("name"):exec() bsw@10: for i, record in ipairs(contact_members) do bsw@10: records[#records+1] = record bsw@10: end bsw@10: ui.field.select{ bsw@10: label = _"Member", bsw@10: name = "member_id", bsw@10: foreign_records = records, bsw@10: foreign_id = "id", bsw@10: foreign_name = "name" bsw@10: } bsw@10: ui.submit{ text = _"Save" } bsw@10: end bsw@10: }