liquid_feedback_frontend

annotate app/main/draft/new.lua @ 1156:08adef9f05b9

Updated installation instructions for WebMCP 2.x
author jbe
date Mon Mar 23 23:17:43 2015 +0100 (2015-03-23)
parents 904f6807f7fa
children 32cc544d5a5b
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@1145 57 local formatting_engine
bsw@1045 58 if config.enforce_formatting_engine then
bsw@1045 59 formatting_engine = config.enforce_formatting_engine
bsw@1045 60 else
bsw@1045 61 formatting_engine = param.get("formatting_engine")
bsw@95 62 end
bsw@1045 63 ui.container{
bsw@1045 64 attr = { class = "draft" },
bsw@1045 65 content = function()
bsw@1045 66 slot.put(format.wiki_text(param.get("content"), formatting_engine))
bsw@1045 67 end
bsw@1045 68 }
bsw@95 69
bsw@1045 70 slot.put("<br />")
bsw@1045 71 ui.tag{
bsw@1045 72 tag = "input",
bsw@1045 73 attr = {
bsw@1045 74 type = "submit",
bsw@1045 75 class = "btn btn-default",
bsw@1045 76 value = _'Publish now'
bsw@1045 77 },
bsw@1045 78 content = ""
bsw@1045 79 }
bsw@1045 80 slot.put("<br />")
bsw@1045 81 slot.put("<br />")
bsw@95 82
poelzi@133 83 ui.tag{
bsw@1045 84 tag = "input",
bsw@1045 85 attr = {
bsw@1045 86 type = "submit",
bsw@1045 87 name = "edit",
bsw@1045 88 class = "btn-link",
bsw@1045 89 value = _'Edit again'
bsw@1045 90 },
bsw@1045 91 content = ""
bsw@1045 92 }
bsw@1045 93 slot.put(" | ")
bsw@1045 94 ui.link{
bsw@1045 95 content = _"Cancel",
bsw@1045 96 module = "initiative",
bsw@1045 97 view = "show",
bsw@1045 98 id = initiative.id
bsw@1045 99 }
bsw@1045 100 end )
bsw@1045 101
bsw@1045 102 else
bsw@1045 103 ui.sectionRow( function()
bsw@1045 104 execute.view{ module = "initiative", view = "_sidebar_wikisyntax" }
bsw@1045 105
bsw@1045 106 if not config.enforce_formatting_engine then
bsw@1045 107 ui.field.select{
bsw@1045 108 label = _"Wiki engine",
bsw@1045 109 name = "formatting_engine",
bsw@1045 110 foreign_records = config.formatting_engines,
bsw@1045 111 attr = {id = "formatting_engine"},
bsw@1045 112 foreign_id = "id",
bsw@1045 113 foreign_name = "name"
bsw@1045 114 }
bsw@1045 115 end
bsw@1045 116
bsw@1045 117 ui.heading{ level = 2, content = _"Enter your proposal and/or reasons" }
bsw@1045 118
bsw@1045 119 ui.field.text{
bsw@1045 120 name = "content",
bsw@1045 121 multiline = true,
bsw@1045 122 attr = { style = "height: 50ex; width: 100%;" },
bsw@1045 123 value = param.get("content")
poelzi@133 124 }
poelzi@133 125 ui.tag{
bsw@1045 126 tag = "input",
bsw@1045 127 attr = {
bsw@1045 128 type = "submit",
bsw@1045 129 name = "preview",
bsw@1045 130 class = "btn btn-default",
bsw@1045 131 value = _'Preview'
bsw@1045 132 },
bsw@1045 133 content = ""
poelzi@133 134 }
bsw@1045 135 slot.put("<br />")
bsw@1045 136 slot.put("<br />")
bsw@1045 137
bsw@1045 138 ui.link{
bsw@1045 139 content = _"Cancel",
bsw@1045 140 module = "initiative",
bsw@1045 141 view = "show",
bsw@1045 142 id = initiative.id
bsw@1045 143 }
bsw@1045 144
bsw@1045 145 end )
bsw@1045 146 end
bsw/jbe@0 147 end
bsw/jbe@0 148 }

Impressum / About Us