liquid_feedback_frontend
view app/main/draft/new.lua @ 1048:58d703bb06e4
Fixed HTML headers in layout files
author | bsw |
---|---|
date | Thu Jul 10 02:27:01 2014 +0200 (2014-07-10) |
parents | 701a5cf6b067 |
children | abee3e49cd44 |
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)
6 execute.view{
7 module = "issue", view = "_head", params = {
8 issue = initiative.issue,
9 initiative = initiative
10 }
11 }
13 execute.view {
14 module = "issue", view = "_sidebar_issue",
15 params = {
16 issue = initiative.issue,
17 }
18 }
22 ui.form{
23 record = initiative.current_draft,
24 attr = { class = "vertical section" },
25 module = "draft",
26 action = "add",
27 params = { initiative_id = initiative.id },
28 routing = {
29 ok = {
30 mode = "redirect",
31 module = "initiative",
32 view = "show",
33 id = initiative.id
34 }
35 },
36 content = function()
38 ui.sectionHead( function()
39 ui.heading { level = 1, content = initiative.display_name }
40 end)
42 if param.get("preview") then
43 ui.sectionRow( function()
44 ui.field.hidden{ name = "formatting_engine", value = param.get("formatting_engine") }
45 ui.field.hidden{ name = "content", value = param.get("content") }
46 if config.enforce_formatting_engine then
47 formatting_engine = config.enforce_formatting_engine
48 else
49 formatting_engine = param.get("formatting_engine")
50 end
51 ui.container{
52 attr = { class = "draft" },
53 content = function()
54 slot.put(format.wiki_text(param.get("content"), formatting_engine))
55 end
56 }
58 slot.put("<br />")
59 ui.tag{
60 tag = "input",
61 attr = {
62 type = "submit",
63 class = "btn btn-default",
64 value = _'Publish now'
65 },
66 content = ""
67 }
68 slot.put("<br />")
69 slot.put("<br />")
71 ui.tag{
72 tag = "input",
73 attr = {
74 type = "submit",
75 name = "edit",
76 class = "btn-link",
77 value = _'Edit again'
78 },
79 content = ""
80 }
81 slot.put(" | ")
82 ui.link{
83 content = _"Cancel",
84 module = "initiative",
85 view = "show",
86 id = initiative.id
87 }
88 end )
90 else
91 ui.sectionRow( function()
92 execute.view{ module = "initiative", view = "_sidebar_wikisyntax" }
94 if not config.enforce_formatting_engine then
95 ui.field.select{
96 label = _"Wiki engine",
97 name = "formatting_engine",
98 foreign_records = config.formatting_engines,
99 attr = {id = "formatting_engine"},
100 foreign_id = "id",
101 foreign_name = "name"
102 }
103 end
105 ui.heading{ level = 2, content = _"Enter your proposal and/or reasons" }
107 ui.field.text{
108 name = "content",
109 multiline = true,
110 attr = { style = "height: 50ex; width: 100%;" },
111 value = param.get("content")
112 }
113 ui.tag{
114 tag = "input",
115 attr = {
116 type = "submit",
117 name = "preview",
118 class = "btn btn-default",
119 value = _'Preview'
120 },
121 content = ""
122 }
123 slot.put("<br />")
124 slot.put("<br />")
126 ui.link{
127 content = _"Cancel",
128 module = "initiative",
129 view = "show",
130 id = initiative.id
131 }
133 end )
134 end
135 end
136 }