bsw@10: local initiative = Initiative:by_id(param.get_id())
bsw@1045: local initiatives = app.session.member
bsw@1045: :get_reference_selector("supported_initiatives")
bsw@1045: :join("issue", nil, "issue.id = initiative.issue_id")
bsw@1045: :add_where("issue.closed ISNULL")
bsw@1045: :add_order_by("issue.id")
bsw@1045: :exec()
bsw@10:
bsw@1045:
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 tmp = { { id = -1, myname = _"Suggest no initiative" }}
bsw@1045: for i, initiative in ipairs(initiatives) do
bsw@1045: initiative.myname = _("Issue ##{issue_id}: #{initiative_name}", {
bsw@1045: issue_id = initiative.issue.id,
bsw@1045: initiative_name = initiative.name
bsw@1045: })
bsw@1045: tmp[#tmp+1] = initiative
bsw@1045: end
bsw@10:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_head", params = {
bsw@1045: issue = initiative.issue,
bsw@1045: member = member
bsw@10: }
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@1045:
bsw@10:
bsw@10: ui.form{
bsw@1045: attr = { class = "wide section" },
bsw@10: module = "initiative",
bsw@10: action = "revoke",
bsw@10: id = initiative.id,
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: }
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 = _"Revoke initiative" }
bsw@1045: end )
bsw@1045:
bsw@1045: ui.sectionRow( function()
bsw@10:
bsw@1045: ui.heading{ level = 2, content = _"Do you want to suggest to support another initiative?" }
bsw@1045:
bsw@1045: ui.field.select{
bsw@1045: name = "suggested_initiative_id",
bsw@1045: foreign_records = tmp,
bsw@1045: foreign_id = "id",
bsw@1045: foreign_name = "myname",
bsw@1045: value = param.get("suggested_initiative_id", atom.integer)
bsw@1045: }
bsw@1045: ui.container{ content = _"You may choose one of the ongoing initiatives you are currently supporting" }
bsw@1045: slot.put("
")
bsw@1045: ui.heading { level = 2, content = _"Are you aware that revoking an initiative is irrevocable?" }
bsw@1045: ui.container{ content = function()
bsw@1045: ui.tag{ tag = "input", attr = {
bsw@1045: type = "checkbox",
bsw@1045: name = "are_you_sure",
bsw@1045: value = "1"
bsw@1045: } }
bsw@1045: ui.tag { content = _"I understand, that this is not revocable" }
bsw@1045: end }
bsw@1045:
bsw@1045:
bsw@1045: slot.put("
")
bsw@1045: ui.tag{
bsw@1045: tag = "input",
bsw@1045: attr = {
bsw@1045: type = "submit",
bsw@1045: class = "btn btn-dangerous",
bsw@1045: value = _"Revoke now"
bsw@1045: },
bsw@1045: content = ""
bsw@1045: }
bsw@1045: slot.put("
")
bsw@1045: slot.put("
")
bsw@10:
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@1045:
bsw@10: end
bsw@10: }