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