rev |
line source |
bsw@1045
|
1 local initiative = Initiative:by_id(param.get("initiative_id"))
|
bsw@1045
|
2 initiative:load_everything_for_member_id(app.session.member_id)
|
bsw@1045
|
3 initiative.issue:load_everything_for_member_id(app.session.member_id)
|
bsw/jbe@0
|
4
|
bsw@1136
|
5 if initiative.issue.closed then
|
bsw@1135
|
6 slot.put_into("error", _"This issue is already closed.")
|
bsw@1135
|
7 return
|
bsw@1136
|
8 elseif initiative.issue.half_frozen then
|
bsw@1135
|
9 slot.put_into("error", _"This issue is already frozen.")
|
bsw@1135
|
10 return
|
bsw@1136
|
11 elseif initiative.issue.phase_finished then
|
bsw@1135
|
12 slot.put_into("error", _"Current phase is already closed.")
|
bsw@1135
|
13 return
|
bsw@1135
|
14 end
|
bsw@1135
|
15
|
bsw/jbe@0
|
16
|
bsw@1045
|
17 execute.view{
|
bsw@1045
|
18 module = "issue", view = "_head", params = {
|
bsw@1045
|
19 issue = initiative.issue,
|
bsw@1045
|
20 initiative = initiative
|
bsw/jbe@4
|
21 }
|
bsw@1045
|
22 }
|
bsw@1045
|
23
|
bsw@1045
|
24 execute.view {
|
bsw@1045
|
25 module = "issue", view = "_sidebar_issue",
|
bsw@1045
|
26 params = {
|
bsw@1045
|
27 issue = initiative.issue,
|
bsw@1045
|
28 }
|
bsw@1045
|
29 }
|
bsw/jbe@4
|
30
|
bsw@95
|
31
|
bsw@95
|
32
|
bsw/jbe@0
|
33 ui.form{
|
bsw@2
|
34 record = initiative.current_draft,
|
bsw@1045
|
35 attr = { class = "vertical section" },
|
bsw/jbe@0
|
36 module = "draft",
|
bsw/jbe@0
|
37 action = "add",
|
bsw@2
|
38 params = { initiative_id = initiative.id },
|
bsw/jbe@0
|
39 routing = {
|
bsw@95
|
40 ok = {
|
bsw/jbe@0
|
41 mode = "redirect",
|
bsw/jbe@0
|
42 module = "initiative",
|
bsw/jbe@0
|
43 view = "show",
|
bsw@2
|
44 id = initiative.id
|
bsw/jbe@0
|
45 }
|
bsw/jbe@0
|
46 },
|
bsw/jbe@0
|
47 content = function()
|
bsw@1045
|
48
|
bsw@1045
|
49 ui.sectionHead( function()
|
bsw@1045
|
50 ui.heading { level = 1, content = initiative.display_name }
|
bsw@1045
|
51 end)
|
bsw@1045
|
52
|
bsw@95
|
53 if param.get("preview") then
|
bsw@1045
|
54 ui.sectionRow( function()
|
bsw@1045
|
55 ui.field.hidden{ name = "formatting_engine", value = param.get("formatting_engine") }
|
bsw@1045
|
56 ui.field.hidden{ name = "content", value = param.get("content") }
|
bsw@1045
|
57 if config.enforce_formatting_engine then
|
bsw@1045
|
58 formatting_engine = config.enforce_formatting_engine
|
bsw@1045
|
59 else
|
bsw@1045
|
60 formatting_engine = param.get("formatting_engine")
|
bsw@95
|
61 end
|
bsw@1045
|
62 ui.container{
|
bsw@1045
|
63 attr = { class = "draft" },
|
bsw@1045
|
64 content = function()
|
bsw@1045
|
65 slot.put(format.wiki_text(param.get("content"), formatting_engine))
|
bsw@1045
|
66 end
|
bsw@1045
|
67 }
|
bsw@95
|
68
|
bsw@1045
|
69 slot.put("<br />")
|
bsw@1045
|
70 ui.tag{
|
bsw@1045
|
71 tag = "input",
|
bsw@1045
|
72 attr = {
|
bsw@1045
|
73 type = "submit",
|
bsw@1045
|
74 class = "btn btn-default",
|
bsw@1045
|
75 value = _'Publish now'
|
bsw@1045
|
76 },
|
bsw@1045
|
77 content = ""
|
bsw@1045
|
78 }
|
bsw@1045
|
79 slot.put("<br />")
|
bsw@1045
|
80 slot.put("<br />")
|
bsw@95
|
81
|
poelzi@133
|
82 ui.tag{
|
bsw@1045
|
83 tag = "input",
|
bsw@1045
|
84 attr = {
|
bsw@1045
|
85 type = "submit",
|
bsw@1045
|
86 name = "edit",
|
bsw@1045
|
87 class = "btn-link",
|
bsw@1045
|
88 value = _'Edit again'
|
bsw@1045
|
89 },
|
bsw@1045
|
90 content = ""
|
bsw@1045
|
91 }
|
bsw@1045
|
92 slot.put(" | ")
|
bsw@1045
|
93 ui.link{
|
bsw@1045
|
94 content = _"Cancel",
|
bsw@1045
|
95 module = "initiative",
|
bsw@1045
|
96 view = "show",
|
bsw@1045
|
97 id = initiative.id
|
bsw@1045
|
98 }
|
bsw@1045
|
99 end )
|
bsw@1045
|
100
|
bsw@1045
|
101 else
|
bsw@1045
|
102 ui.sectionRow( function()
|
bsw@1045
|
103 execute.view{ module = "initiative", view = "_sidebar_wikisyntax" }
|
bsw@1045
|
104
|
bsw@1045
|
105 if not config.enforce_formatting_engine then
|
bsw@1045
|
106 ui.field.select{
|
bsw@1045
|
107 label = _"Wiki engine",
|
bsw@1045
|
108 name = "formatting_engine",
|
bsw@1045
|
109 foreign_records = config.formatting_engines,
|
bsw@1045
|
110 attr = {id = "formatting_engine"},
|
bsw@1045
|
111 foreign_id = "id",
|
bsw@1045
|
112 foreign_name = "name"
|
bsw@1045
|
113 }
|
bsw@1045
|
114 end
|
bsw@1045
|
115
|
bsw@1045
|
116 ui.heading{ level = 2, content = _"Enter your proposal and/or reasons" }
|
bsw@1045
|
117
|
bsw@1045
|
118 ui.field.text{
|
bsw@1045
|
119 name = "content",
|
bsw@1045
|
120 multiline = true,
|
bsw@1045
|
121 attr = { style = "height: 50ex; width: 100%;" },
|
bsw@1045
|
122 value = param.get("content")
|
poelzi@133
|
123 }
|
poelzi@133
|
124 ui.tag{
|
bsw@1045
|
125 tag = "input",
|
bsw@1045
|
126 attr = {
|
bsw@1045
|
127 type = "submit",
|
bsw@1045
|
128 name = "preview",
|
bsw@1045
|
129 class = "btn btn-default",
|
bsw@1045
|
130 value = _'Preview'
|
bsw@1045
|
131 },
|
bsw@1045
|
132 content = ""
|
poelzi@133
|
133 }
|
bsw@1045
|
134 slot.put("<br />")
|
bsw@1045
|
135 slot.put("<br />")
|
bsw@1045
|
136
|
bsw@1045
|
137 ui.link{
|
bsw@1045
|
138 content = _"Cancel",
|
bsw@1045
|
139 module = "initiative",
|
bsw@1045
|
140 view = "show",
|
bsw@1045
|
141 id = initiative.id
|
bsw@1045
|
142 }
|
bsw@1045
|
143
|
bsw@1045
|
144 end )
|
bsw@1045
|
145 end
|
bsw/jbe@0
|
146 end
|
bsw/jbe@0
|
147 }
|