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@1564
|
32
|
bsw@1564
|
33 ui.grid{ content = function()
|
bsw@1564
|
34 ui.cell_main{ content = function()
|
bsw@1564
|
35
|
bsw@1564
|
36 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw@10
|
37
|
bsw@1564
|
38 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw@1564
|
39 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Revoke initiative" }
|
bsw@1564
|
40 end }
|
bsw@1045
|
41
|
bsw@1564
|
42 ui.container{ attr = { class = "mdl-card__content" }, content = function()
|
bsw@1045
|
43
|
bsw@1564
|
44 ui.form{
|
bsw@1564
|
45 attr = { class = "wide section" },
|
bsw@1564
|
46 module = "initiative",
|
bsw@1564
|
47 action = "revoke",
|
bsw@1564
|
48 id = initiative.id,
|
bsw@1564
|
49 routing = {
|
bsw@1564
|
50 ok = {
|
bsw@1564
|
51 mode = "redirect",
|
bsw@1564
|
52 module = "initiative",
|
bsw@1564
|
53 view = "show",
|
bsw@1564
|
54 id = initiative.id
|
bsw@1564
|
55 }
|
bsw@1564
|
56 },
|
bsw@1564
|
57 content = function()
|
bsw@10
|
58
|
bsw@1564
|
59 ui.container{ content = _"Do you want to suggest to support another initiative?" }
|
bsw@1564
|
60 ui.container{ content = _"You may choose one of the ongoing initiatives you are currently supporting" }
|
bsw@1564
|
61
|
bsw@1564
|
62 slot.put("<br />")
|
bsw@1045
|
63
|
bsw@1564
|
64 ui.field.select{
|
bsw@1564
|
65 name = "suggested_initiative_id",
|
bsw@1564
|
66 foreign_records = tmp,
|
bsw@1564
|
67 foreign_id = "id",
|
bsw@1564
|
68 foreign_name = "myname",
|
bsw@1564
|
69 value = param.get("suggested_initiative_id", atom.integer)
|
bsw@1564
|
70 }
|
bsw@1564
|
71 slot.put("<br />")
|
bsw@1564
|
72 ui.container { content = _"Are you aware that revoking an initiative is irrevocable?" }
|
bsw@1564
|
73 slot.put("<br />")
|
bsw@1564
|
74 ui.container{ content = function()
|
bsw@1564
|
75 ui.tag{ tag = "input", attr = {
|
bsw@1564
|
76 type = "checkbox",
|
bsw@1564
|
77 name = "are_you_sure",
|
bsw@1564
|
78 value = "1"
|
bsw@1564
|
79 } }
|
bsw@1564
|
80 ui.tag { content = _"I understand, that this is not revocable" }
|
bsw@1564
|
81 end }
|
bsw@1564
|
82
|
bsw@1564
|
83
|
bsw@1564
|
84 slot.put("<br />")
|
bsw@1564
|
85 ui.tag{
|
bsw@1564
|
86 tag = "input",
|
bsw@1564
|
87 attr = {
|
bsw@1564
|
88 type = "submit",
|
bsw@1564
|
89 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
|
bsw@1564
|
90 value = _"Revoke now"
|
bsw@1564
|
91 },
|
bsw@1564
|
92 content = ""
|
bsw@1564
|
93 }
|
bsw@1564
|
94 slot.put(" ")
|
bsw@10
|
95
|
bsw@1564
|
96 ui.link{
|
bsw@1564
|
97 attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
|
bsw@1564
|
98 content = _"Cancel",
|
bsw@1564
|
99 module = "initiative",
|
bsw@1564
|
100 view = "show",
|
bsw@1564
|
101 id = initiative.id,
|
bsw@1564
|
102 params = {
|
bsw@1564
|
103 tab = "initiators"
|
bsw@1564
|
104 }
|
bsw@1564
|
105 }
|
bsw@1564
|
106
|
bsw@1564
|
107 end
|
bsw@1564
|
108 }
|
bsw@1564
|
109
|
bsw@1045
|
110 end }
|
bsw@1564
|
111 end }
|
bsw@1564
|
112 end }
|
bsw@1564
|
113 end }
|