bsw@1045: local initiative = Initiative:by_id(param.get("initiative_id")) bsw@1045: initiative:load_everything_for_member_id(app.session.member_id) bsw@1045: initiative.issue:load_everything_for_member_id(app.session.member_id) bsw/jbe@0: bsw@1136: if initiative.issue.closed then bsw@1135: slot.put_into("error", _"This issue is already closed.") bsw@1135: request.redirect{ module = "initiative", view = "show", id = initiative.id } bsw@1135: return bsw@1136: elseif initiative.issue.half_frozen then bsw@1135: slot.put_into("error", _"This issue is already frozen.") bsw@1135: request.redirect{ module = "initiative", view = "show", id = initiative.id } bsw@1135: return bsw@1136: elseif initiative.issue.phase_finished then bsw@1135: slot.put_into("error", _"Current phase is already closed.") bsw@1135: request.redirect{ module = "initiative", view = "show", id = initiative.id } bsw@1135: return bsw@1135: end bsw@1135: bsw/jbe@0: bsw@1045: execute.view{ bsw@1045: module = "issue", view = "_head", params = { bsw@1045: issue = initiative.issue, bsw@1045: initiative = initiative bsw/jbe@4: } bsw@1045: } bsw@1045: bsw@1045: execute.view { bsw@1045: module = "issue", view = "_sidebar_issue", bsw@1045: params = { bsw@1045: issue = initiative.issue, bsw@1045: } bsw@1045: } bsw/jbe@4: bsw@95: bsw@95: bsw/jbe@0: ui.form{ bsw@2: record = initiative.current_draft, bsw@1045: attr = { class = "vertical section" }, bsw/jbe@0: module = "draft", bsw/jbe@0: action = "add", bsw@2: params = { initiative_id = initiative.id }, bsw/jbe@0: routing = { bsw@95: ok = { bsw/jbe@0: mode = "redirect", bsw/jbe@0: module = "initiative", bsw/jbe@0: view = "show", bsw@2: id = initiative.id bsw/jbe@0: } bsw/jbe@0: }, bsw/jbe@0: content = function() bsw@1045: bsw@1045: ui.sectionHead( function() bsw@1045: ui.heading { level = 1, content = initiative.display_name } bsw@1045: end) bsw@1045: bsw@95: if param.get("preview") then bsw@1045: ui.sectionRow( function() bsw@1045: ui.field.hidden{ name = "formatting_engine", value = param.get("formatting_engine") } bsw@1045: ui.field.hidden{ name = "content", value = param.get("content") } bsw@1045: if config.enforce_formatting_engine then bsw@1045: formatting_engine = config.enforce_formatting_engine bsw@1045: else bsw@1045: formatting_engine = param.get("formatting_engine") bsw@95: end bsw@1045: ui.container{ bsw@1045: attr = { class = "draft" }, bsw@1045: content = function() bsw@1045: slot.put(format.wiki_text(param.get("content"), formatting_engine)) bsw@1045: end bsw@1045: } bsw@95: bsw@1045: slot.put("
") bsw@1045: ui.tag{ bsw@1045: tag = "input", bsw@1045: attr = { bsw@1045: type = "submit", bsw@1045: class = "btn btn-default", bsw@1045: value = _'Publish now' bsw@1045: }, bsw@1045: content = "" bsw@1045: } bsw@1045: slot.put("
") bsw@1045: slot.put("
") bsw@95: poelzi@133: ui.tag{ bsw@1045: tag = "input", bsw@1045: attr = { bsw@1045: type = "submit", bsw@1045: name = "edit", bsw@1045: class = "btn-link", bsw@1045: value = _'Edit again' bsw@1045: }, bsw@1045: content = "" bsw@1045: } bsw@1045: slot.put(" | ") bsw@1045: ui.link{ bsw@1045: content = _"Cancel", bsw@1045: module = "initiative", bsw@1045: view = "show", bsw@1045: id = initiative.id bsw@1045: } bsw@1045: end ) bsw@1045: bsw@1045: else bsw@1045: ui.sectionRow( function() bsw@1045: execute.view{ module = "initiative", view = "_sidebar_wikisyntax" } bsw@1045: bsw@1045: if not config.enforce_formatting_engine then bsw@1045: ui.field.select{ bsw@1045: label = _"Wiki engine", bsw@1045: name = "formatting_engine", bsw@1045: foreign_records = config.formatting_engines, bsw@1045: attr = {id = "formatting_engine"}, bsw@1045: foreign_id = "id", bsw@1045: foreign_name = "name" bsw@1045: } bsw@1045: end bsw@1045: bsw@1045: ui.heading{ level = 2, content = _"Enter your proposal and/or reasons" } bsw@1045: bsw@1045: ui.field.text{ bsw@1045: name = "content", bsw@1045: multiline = true, bsw@1045: attr = { style = "height: 50ex; width: 100%;" }, bsw@1045: value = param.get("content") poelzi@133: } poelzi@133: ui.tag{ bsw@1045: tag = "input", bsw@1045: attr = { bsw@1045: type = "submit", bsw@1045: name = "preview", bsw@1045: class = "btn btn-default", bsw@1045: value = _'Preview' bsw@1045: }, bsw@1045: content = "" poelzi@133: } bsw@1045: slot.put("
") bsw@1045: slot.put("
") bsw@1045: bsw@1045: ui.link{ bsw@1045: content = _"Cancel", bsw@1045: module = "initiative", bsw@1045: view = "show", bsw@1045: id = initiative.id bsw@1045: } bsw@1045: bsw@1045: end ) bsw@1045: end bsw/jbe@0: end bsw/jbe@0: }