liquid_feedback_frontend

annotate app/main/draft/new.lua @ 1135:abee3e49cd44

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

Impressum / About Us