liquid_feedback_frontend

view app/main/draft/new.lua @ 1304:0bae319805ff

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

Impressum / About Us