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@1309
|
16 local draft = initiative.current_draft
|
bsw/jbe@1309
|
17 if config.initiative_abstract then
|
bsw/jbe@1309
|
18 draft.abstract = string.match(draft.content, "(.+)<!%--END_OF_ABSTRACT%-->")
|
bsw/jbe@1309
|
19 if draft.abstract then
|
bsw/jbe@1309
|
20 draft.content = string.match(draft.content, "<!%--END_OF_ABSTRACT%-->(.*)")
|
bsw/jbe@1309
|
21 end
|
bsw/jbe@1309
|
22 end
|
bsw@95
|
23
|
bsw/jbe@0
|
24 ui.form{
|
bsw/jbe@1309
|
25 record = draft,
|
bsw@1045
|
26 attr = { class = "vertical section" },
|
bsw/jbe@0
|
27 module = "draft",
|
bsw/jbe@0
|
28 action = "add",
|
bsw@2
|
29 params = { initiative_id = initiative.id },
|
bsw/jbe@0
|
30 routing = {
|
bsw@95
|
31 ok = {
|
bsw/jbe@0
|
32 mode = "redirect",
|
bsw/jbe@0
|
33 module = "initiative",
|
bsw/jbe@0
|
34 view = "show",
|
bsw@2
|
35 id = initiative.id
|
bsw/jbe@0
|
36 }
|
bsw/jbe@0
|
37 },
|
bsw/jbe@0
|
38 content = function()
|
bsw@1045
|
39
|
bsw/jbe@1309
|
40 ui.grid{ content = function()
|
bsw/jbe@1309
|
41 ui.cell_main{ content = function()
|
bsw/jbe@1309
|
42 ui.container{ attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
|
bsw/jbe@1309
|
43 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
44 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = initiative.display_name }
|
bsw/jbe@1309
|
45 end }
|
bsw/jbe@1309
|
46 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
47 if param.get("preview") then
|
bsw/jbe@1309
|
48 ui.sectionRow( function()
|
bsw/jbe@1309
|
49 if config.initiative_abstract then
|
bsw/jbe@1309
|
50 ui.field.hidden{ name = "abstract", value = param.get("abstract") }
|
bsw/jbe@1309
|
51 ui.container{
|
bsw/jbe@1309
|
52 attr = { class = "abstract" },
|
bsw/jbe@1309
|
53 content = param.get("abstract")
|
bsw/jbe@1309
|
54 }
|
bsw/jbe@1309
|
55 slot.put("<br />")
|
bsw/jbe@1309
|
56 end
|
bsw/jbe@1309
|
57 local draft_text = param.get("content")
|
bsw/jbe@1309
|
58 local draft_text = util.wysihtml_preproc(draft_text)
|
bsw/jbe@1309
|
59 ui.field.hidden{ name = "content", value = draft_text }
|
bsw/jbe@1309
|
60 ui.container{
|
bsw/jbe@1309
|
61 attr = { class = "draft" },
|
bsw/jbe@1309
|
62 content = function()
|
bsw/jbe@1309
|
63 slot.put(draft_text)
|
bsw/jbe@1309
|
64 end
|
bsw/jbe@1309
|
65 }
|
bsw/jbe@1309
|
66 slot.put("<br />")
|
bsw@95
|
67
|
bsw/jbe@1309
|
68 ui.tag{
|
bsw/jbe@1309
|
69 tag = "input",
|
bsw/jbe@1309
|
70 attr = {
|
bsw/jbe@1309
|
71 type = "submit",
|
bsw/jbe@1309
|
72 class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored",
|
bsw/jbe@1309
|
73 value = _'Publish now'
|
bsw/jbe@1309
|
74 },
|
bsw/jbe@1309
|
75 content = ""
|
bsw/jbe@1309
|
76 }
|
bsw/jbe@1309
|
77 slot.put(" ")
|
bsw/jbe@1309
|
78
|
bsw/jbe@1309
|
79 ui.tag{
|
bsw/jbe@1309
|
80 tag = "input",
|
bsw/jbe@1309
|
81 attr = {
|
bsw/jbe@1309
|
82 type = "submit",
|
bsw/jbe@1309
|
83 name = "edit",
|
bsw/jbe@1309
|
84 class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect",
|
bsw/jbe@1309
|
85 value = _'Edit again'
|
bsw/jbe@1309
|
86 },
|
bsw/jbe@1309
|
87 content = ""
|
bsw/jbe@1309
|
88 }
|
bsw/jbe@1309
|
89 slot.put(" ")
|
bsw@95
|
90
|
bsw/jbe@1309
|
91 ui.link{
|
bsw/jbe@1309
|
92 attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" },
|
bsw/jbe@1309
|
93 content = _"Cancel",
|
bsw/jbe@1309
|
94 module = "initiative",
|
bsw/jbe@1309
|
95 view = "show",
|
bsw/jbe@1309
|
96 id = initiative.id
|
bsw/jbe@1309
|
97 }
|
bsw/jbe@1309
|
98 end )
|
bsw@1045
|
99
|
bsw/jbe@1309
|
100 else
|
bsw/jbe@1309
|
101 ui.sectionRow( function()
|
bsw/jbe@1309
|
102 if config.initiative_abstract then
|
bsw/jbe@1309
|
103 ui.container { content = _"Enter abstract:" }
|
bsw/jbe@1309
|
104 ui.container{ attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield__fullwidth" }, content = function()
|
bsw/jbe@1309
|
105 ui.field.text{
|
bsw/jbe@1309
|
106 name = "abstract",
|
bsw/jbe@1309
|
107 multiline = true,
|
bsw/jbe@1309
|
108 attr = { id = "abstract", style = "height: 20ex; width: 100%;" },
|
bsw/jbe@1309
|
109 value = param.get("abstract")
|
bsw/jbe@1309
|
110 }
|
bsw/jbe@1309
|
111 end }
|
bsw/jbe@1309
|
112 end
|
bsw/jbe@1309
|
113
|
bsw/jbe@1309
|
114 ui.container { content = _"Enter your proposal and/or reasons:" }
|
bsw/jbe@1309
|
115 ui.field.wysihtml{
|
bsw/jbe@1309
|
116 name = "content",
|
bsw/jbe@1309
|
117 multiline = true,
|
bsw/jbe@1309
|
118 attr = { id = "draft", style = "height: 50ex; width: 100%;" },
|
bsw/jbe@1309
|
119 value = param.get("content")
|
bsw/jbe@1309
|
120 }
|
bsw/jbe@1309
|
121 if not issue or issue.state == "admission" or issue.state == "discussion" then
|
bsw/jbe@1309
|
122 ui.container { content = _"You can change your text again anytime during admission and discussion phase" }
|
bsw/jbe@1309
|
123 else
|
bsw/jbe@1309
|
124 ui.container { content = _"You cannot change your text again later, because this issue is already in verfication phase!" }
|
bsw/jbe@1309
|
125 end
|
bsw/jbe@1309
|
126 slot.put("<br />")
|
bsw@1045
|
127
|
bsw/jbe@1309
|
128 ui.tag{
|
bsw/jbe@1309
|
129 tag = "input",
|
bsw/jbe@1309
|
130 attr = {
|
bsw/jbe@1309
|
131 type = "submit",
|
bsw/jbe@1309
|
132 name = "preview",
|
bsw/jbe@1309
|
133 class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored",
|
bsw/jbe@1309
|
134 value = _'Preview'
|
bsw/jbe@1309
|
135 },
|
bsw/jbe@1309
|
136 content = ""
|
bsw/jbe@1309
|
137 }
|
bsw/jbe@1309
|
138 slot.put(" ")
|
bsw/jbe@1309
|
139
|
bsw/jbe@1309
|
140 ui.link{
|
bsw/jbe@1309
|
141 content = _"Cancel",
|
bsw/jbe@1309
|
142 module = "initiative",
|
bsw/jbe@1309
|
143 view = "show",
|
bsw/jbe@1309
|
144 id = initiative.id,
|
bsw/jbe@1309
|
145 attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" }
|
bsw/jbe@1309
|
146 }
|
bsw/jbe@1309
|
147
|
bsw/jbe@1309
|
148 end )
|
bsw/jbe@1309
|
149 end
|
bsw/jbe@1309
|
150 end }
|
bsw/jbe@1309
|
151 end }
|
bsw/jbe@1309
|
152 end }
|
bsw/jbe@1309
|
153 end }
|
bsw/jbe@0
|
154 end
|
bsw/jbe@0
|
155 }
|