liquid_feedback_frontend

annotate app/main/initiative/revoke.lua @ 1045:701a5cf6b067

Imported LiquidFeedback Frontend 3.0 branch
author bsw
date Thu Jul 10 01:19:48 2014 +0200 (2014-07-10)
parents 72c5e0ee7c98
children 15f33adc0e31
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@1045 6 :add_order_by("issue.id")
bsw@1045 7 :exec()
bsw@10 8
bsw@1045 9
bsw@1045 10 local member = app.session.member
bsw@1045 11 if member then
bsw@1045 12 initiative:load_everything_for_member_id(member.id)
bsw@1045 13 initiative.issue:load_everything_for_member_id(member.id)
bsw@1045 14 end
bsw@1045 15
bsw@1045 16
bsw@1045 17 local tmp = { { id = -1, myname = _"Suggest no initiative" }}
bsw@1045 18 for i, initiative in ipairs(initiatives) do
bsw@1045 19 initiative.myname = _("Issue ##{issue_id}: #{initiative_name}", {
bsw@1045 20 issue_id = initiative.issue.id,
bsw@1045 21 initiative_name = initiative.name
bsw@1045 22 })
bsw@1045 23 tmp[#tmp+1] = initiative
bsw@1045 24 end
bsw@10 25
bsw@1045 26 execute.view {
bsw@1045 27 module = "issue", view = "_head", params = {
bsw@1045 28 issue = initiative.issue,
bsw@1045 29 member = member
bsw@10 30 }
bsw@1045 31 }
bsw@1045 32 execute.view{ module = "issue", view = "_sidebar_state", params = {
bsw@1045 33 initiative = initiative
bsw@1045 34 } }
bsw@10 35
bsw@1045 36 execute.view {
bsw@1045 37 module = "issue", view = "_sidebar_issue",
bsw@1045 38 params = {
bsw@1045 39 issue = initiative.issue,
bsw@1045 40 highlight_initiative_id = initiative.id
bsw@1045 41 }
bsw@1045 42 }
bsw@1045 43
bsw@1045 44 execute.view {
bsw@1045 45 module = "issue", view = "_sidebar_whatcanido",
bsw@1045 46 params = { initiative = initiative }
bsw@1045 47 }
bsw@1045 48
bsw@1045 49 execute.view {
bsw@1045 50 module = "issue", view = "_sidebar_members", params = {
bsw@1045 51 issue = initiative.issue, initiative = initiative
bsw@1045 52 }
bsw@1045 53 }
bsw@1045 54
bsw@10 55
bsw@10 56 ui.form{
bsw@1045 57 attr = { class = "wide section" },
bsw@10 58 module = "initiative",
bsw@10 59 action = "revoke",
bsw@10 60 id = initiative.id,
bsw@10 61 routing = {
bsw@10 62 ok = {
bsw@10 63 mode = "redirect",
bsw@10 64 module = "initiative",
bsw@10 65 view = "show",
bsw@10 66 id = initiative.id
bsw@10 67 }
bsw@10 68 },
bsw@10 69 content = function()
bsw@1045 70
bsw@1045 71 ui.sectionHead( function()
bsw@1045 72 ui.link{
bsw@1045 73 module = "initiative", view = "show", id = initiative.id,
bsw@1045 74 content = function ()
bsw@1045 75 ui.heading {
bsw@1045 76 level = 1,
bsw@1045 77 content = initiative.display_name
bsw@1045 78 }
bsw@1045 79 end
bsw@1045 80 }
bsw@1045 81 ui.heading { level = 2, content = _"Revoke initiative" }
bsw@1045 82 end )
bsw@1045 83
bsw@1045 84 ui.sectionRow( function()
bsw@10 85
bsw@1045 86 ui.heading{ level = 2, content = _"Do you want to suggest to support another initiative?" }
bsw@1045 87
bsw@1045 88 ui.field.select{
bsw@1045 89 name = "suggested_initiative_id",
bsw@1045 90 foreign_records = tmp,
bsw@1045 91 foreign_id = "id",
bsw@1045 92 foreign_name = "myname",
bsw@1045 93 value = param.get("suggested_initiative_id", atom.integer)
bsw@1045 94 }
bsw@1045 95 ui.container{ content = _"You may choose one of the ongoing initiatives you are currently supporting" }
bsw@1045 96 slot.put("<br />")
bsw@1045 97 ui.heading { level = 2, content = _"Are you aware that revoking an initiative is irrevocable?" }
bsw@1045 98 ui.container{ content = function()
bsw@1045 99 ui.tag{ tag = "input", attr = {
bsw@1045 100 type = "checkbox",
bsw@1045 101 name = "are_you_sure",
bsw@1045 102 value = "1"
bsw@1045 103 } }
bsw@1045 104 ui.tag { content = _"I understand, that this is not revocable" }
bsw@1045 105 end }
bsw@1045 106
bsw@1045 107
bsw@1045 108 slot.put("<br />")
bsw@1045 109 ui.tag{
bsw@1045 110 tag = "input",
bsw@1045 111 attr = {
bsw@1045 112 type = "submit",
bsw@1045 113 class = "btn btn-dangerous",
bsw@1045 114 value = _"Revoke now"
bsw@1045 115 },
bsw@1045 116 content = ""
bsw@1045 117 }
bsw@1045 118 slot.put("<br />")
bsw@1045 119 slot.put("<br />")
bsw@10 120
bsw@1045 121 ui.link{
bsw@1045 122 content = _"Cancel",
bsw@1045 123 module = "initiative",
bsw@1045 124 view = "show",
bsw@1045 125 id = initiative.id,
bsw@1045 126 params = {
bsw@1045 127 tab = "initiators"
bsw@1045 128 }
bsw@1045 129 }
bsw@1045 130 end )
bsw@1045 131
bsw@10 132 end
bsw@10 133 }

Impressum / About Us