bsw@10: local initiative = Initiative:by_id(param.get("initiative_id"))
bsw@10:
bsw@1045: local member = app.session.member
bsw@1045: if member then
bsw@1045: initiative:load_everything_for_member_id(member.id)
bsw@1045: initiative.issue:load_everything_for_member_id(member.id)
bsw@1045: end
bsw@1045:
bsw@1045:
bsw@1045: local records = {
bsw@1045: {
bsw@1045: id = "-1",
bsw@1045: name = _"Choose member"
bsw@1045: }
bsw@1045: }
bsw@1045: local contact_members = app.session.member:get_reference_selector("saved_members"):add_order_by("name"):exec()
bsw@1045: for i, record in ipairs(contact_members) do
bsw@1045: records[#records+1] = record
bsw@1045: end
bsw@10:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_head", params = {
bsw@1045: issue = initiative.issue,
bsw@1045: member = app.session.member
bsw@10: }
bsw@1045: }
bsw@1045:
bsw@1045: execute.view{ module = "issue", view = "_sidebar_state", params = {
bsw@1045: initiative = initiative
bsw@1045: } }
bsw@10:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_sidebar_issue",
bsw@1045: params = {
bsw@1045: issue = initiative.issue,
bsw@1045: highlight_initiative_id = initiative.id
bsw@1045: }
bsw@1045: }
bsw@1045:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_sidebar_whatcanido",
bsw@1045: params = { initiative = initiative }
bsw@1045: }
bsw@1045:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_sidebar_members", params = {
bsw@1045: issue = initiative.issue, initiative = initiative
bsw@1045: }
bsw@1045: }
bsw@10:
bsw@10: ui.form{
bsw@1045: attr = { class = "wide section" },
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@1045:
bsw@1045: ui.sectionHead( function()
bsw@1045: ui.link{
bsw@1045: module = "initiative", view = "show", id = initiative.id,
bsw@1045: content = function ()
bsw@1045: ui.heading {
bsw@1045: level = 1,
bsw@1045: content = initiative.display_name
bsw@1045: }
bsw@1045: end
bsw@1045: }
bsw@1045: ui.heading { level = 2, content = _"Invite an initiator to initiative" }
bsw@1045: end )
bsw@1045:
bsw@1045: ui.sectionRow( function()
bsw@1045: ui.heading { level = 2, content = _"Choose a member to invite" }
bsw@1045: ui.field.select{
bsw@1045: name = "member_id",
bsw@1045: foreign_records = records,
bsw@1045: foreign_id = "id",
bsw@1045: foreign_name = "name"
bsw@10: }
bsw@1045: ui.container{ content = _"You can choose only members which you have been saved as contact before." }
bsw@1045: slot.put("
")
bsw@1045: ui.tag{
bsw@1045: tag = "input",
bsw@1045: attr = {
bsw@1045: type = "submit",
bsw@1045: class = "btn btn-default",
bsw@1045: value = _"Invite member"
bsw@1045: },
bsw@1045: content = ""
bsw@1045: }
bsw@1045: slot.put("
")
bsw@1045: slot.put("
")
bsw@1045: ui.link{
bsw@1045: content = _"Cancel",
bsw@1045: module = "initiative",
bsw@1045: view = "show",
bsw@1045: id = initiative.id,
bsw@1045: params = {
bsw@1045: tab = "initiators"
bsw@1045: }
bsw@1045: }
bsw@1045: end )
bsw@10: end
bsw@10: }