liquid_feedback_frontend

annotate app/main/initiative/revoke.lua @ 1858:3d1f0464a3ea

Handle missing ldap.member.allowed function
author bsw
date Tue Sep 20 17:35:29 2022 +0200 (20 months ago)
parents 0cdd70825c45
children
rev   line source
bsw@10 1 local initiative = Initiative:by_id(param.get_id())
bsw@1045 2 local initiatives = app.session.member
bsw@1045 3 :get_reference_selector("supported_initiatives")
bsw@1045 4 :join("issue", nil, "issue.id = initiative.issue_id")
bsw@1045 5 :add_where("issue.closed ISNULL")
bsw@1565 6 :add_where{ "initiative.id <> ?", initiative.id }
bsw@1045 7 :add_order_by("issue.id")
bsw@1045 8 :exec()
bsw@10 9
bsw@1045 10
bsw@1045 11 local member = app.session.member
bsw@1045 12 if member then
bsw@1045 13 initiative:load_everything_for_member_id(member.id)
bsw@1045 14 initiative.issue:load_everything_for_member_id(member.id)
bsw@1045 15 end
bsw@1045 16
bsw@1045 17
bsw@1045 18 local tmp = { { id = -1, myname = _"Suggest no initiative" }}
bsw@1045 19 for i, initiative in ipairs(initiatives) do
bsw@1045 20 initiative.myname = _("Issue ##{issue_id}: #{initiative_name}", {
bsw@1045 21 issue_id = initiative.issue.id,
bsw@1045 22 initiative_name = initiative.name
bsw@1045 23 })
bsw@1045 24 tmp[#tmp+1] = initiative
bsw@1045 25 end
bsw@10 26
bsw@1045 27 execute.view {
bsw@1045 28 module = "issue", view = "_head", params = {
bsw@1045 29 issue = initiative.issue,
bsw@1045 30 member = member
bsw@10 31 }
bsw@1045 32 }
bsw@1564 33
bsw@1564 34 ui.grid{ content = function()
bsw@1564 35 ui.cell_main{ content = function()
bsw@1564 36
bsw@1564 37 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@10 38
bsw@1564 39 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1564 40 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Revoke initiative" }
bsw@1564 41 end }
bsw@1045 42
bsw@1564 43 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1045 44
bsw@1564 45 ui.form{
bsw@1564 46 attr = { class = "wide section" },
bsw@1564 47 module = "initiative",
bsw@1564 48 action = "revoke",
bsw@1564 49 id = initiative.id,
bsw@1564 50 routing = {
bsw@1564 51 ok = {
bsw@1564 52 mode = "redirect",
bsw@1564 53 module = "initiative",
bsw@1564 54 view = "show",
bsw@1564 55 id = initiative.id
bsw@1564 56 }
bsw@1564 57 },
bsw@1564 58 content = function()
bsw@10 59
bsw@1564 60 ui.container{ content = _"Do you want to suggest to support another initiative?" }
bsw@1564 61 ui.container{ content = _"You may choose one of the ongoing initiatives you are currently supporting" }
bsw@1564 62
bsw@1564 63 slot.put("<br />")
bsw@1045 64
bsw@1564 65 ui.field.select{
bsw@1564 66 name = "suggested_initiative_id",
bsw@1564 67 foreign_records = tmp,
bsw@1564 68 foreign_id = "id",
bsw@1564 69 foreign_name = "myname",
bsw@1564 70 value = param.get("suggested_initiative_id", atom.integer)
bsw@1564 71 }
bsw@1564 72 slot.put("<br />")
bsw@1564 73 ui.container { content = _"Are you aware that revoking an initiative is irrevocable?" }
bsw@1564 74 slot.put("<br />")
bsw@1564 75 ui.container{ content = function()
bsw@1564 76 ui.tag{ tag = "input", attr = {
bsw@1564 77 type = "checkbox",
bsw@1564 78 name = "are_you_sure",
bsw@1564 79 value = "1"
bsw@1564 80 } }
bsw@1564 81 ui.tag { content = _"I understand, that this is not revocable" }
bsw@1564 82 end }
bsw@1564 83
bsw@1564 84
bsw@1564 85 slot.put("<br />")
bsw@1564 86 ui.tag{
bsw@1564 87 tag = "input",
bsw@1564 88 attr = {
bsw@1564 89 type = "submit",
bsw@1564 90 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
bsw@1564 91 value = _"Revoke now"
bsw@1564 92 },
bsw@1564 93 content = ""
bsw@1564 94 }
bsw@1564 95 slot.put(" &nbsp; ")
bsw@10 96
bsw@1564 97 ui.link{
bsw@1564 98 attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
bsw@1564 99 content = _"Cancel",
bsw@1564 100 module = "initiative",
bsw@1564 101 view = "show",
bsw@1564 102 id = initiative.id,
bsw@1564 103 params = {
bsw@1564 104 tab = "initiators"
bsw@1564 105 }
bsw@1564 106 }
bsw@1564 107
bsw@1564 108 end
bsw@1564 109 }
bsw@1564 110
bsw@1045 111 end }
bsw@1564 112 end }
bsw@1564 113 end }
bsw@1564 114 end }

Impressum / About Us