liquid_feedback_frontend
diff app/main/draft/new.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
author | bsw/jbe |
---|---|
date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
parents | 904f6807f7fa |
children | 17e7082c377a |
line diff
1.1 --- a/app/main/draft/new.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/draft/new.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -13,25 +13,16 @@ 1.4 return 1.5 end 1.6 1.7 - 1.8 -execute.view{ 1.9 - module = "issue", view = "_head", params = { 1.10 - issue = initiative.issue, 1.11 - initiative = initiative 1.12 - } 1.13 -} 1.14 - 1.15 -execute.view { 1.16 - module = "issue", view = "_sidebar_issue", 1.17 - params = { 1.18 - issue = initiative.issue, 1.19 - } 1.20 -} 1.21 - 1.22 - 1.23 +local draft = initiative.current_draft 1.24 +if config.initiative_abstract then 1.25 + draft.abstract = string.match(draft.content, "(.+)<!%--END_OF_ABSTRACT%-->") 1.26 + if draft.abstract then 1.27 + draft.content = string.match(draft.content, "<!%--END_OF_ABSTRACT%-->(.*)") 1.28 + end 1.29 +end 1.30 1.31 ui.form{ 1.32 - record = initiative.current_draft, 1.33 + record = draft, 1.34 attr = { class = "vertical section" }, 1.35 module = "draft", 1.36 action = "add", 1.37 @@ -46,103 +37,119 @@ 1.38 }, 1.39 content = function() 1.40 1.41 - ui.sectionHead( function() 1.42 - ui.heading { level = 1, content = initiative.display_name } 1.43 - end) 1.44 - 1.45 - if param.get("preview") then 1.46 - ui.sectionRow( function() 1.47 - ui.field.hidden{ name = "formatting_engine", value = param.get("formatting_engine") } 1.48 - ui.field.hidden{ name = "content", value = param.get("content") } 1.49 - local formatting_engine 1.50 - if config.enforce_formatting_engine then 1.51 - formatting_engine = config.enforce_formatting_engine 1.52 - else 1.53 - formatting_engine = param.get("formatting_engine") 1.54 - end 1.55 - ui.container{ 1.56 - attr = { class = "draft" }, 1.57 - content = function() 1.58 - slot.put(format.wiki_text(param.get("content"), formatting_engine)) 1.59 - end 1.60 - } 1.61 + ui.grid{ content = function() 1.62 + ui.cell_main{ content = function() 1.63 + ui.container{ attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function() 1.64 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.65 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = initiative.display_name } 1.66 + end } 1.67 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.68 + if param.get("preview") then 1.69 + ui.sectionRow( function() 1.70 + if config.initiative_abstract then 1.71 + ui.field.hidden{ name = "abstract", value = param.get("abstract") } 1.72 + ui.container{ 1.73 + attr = { class = "abstract" }, 1.74 + content = param.get("abstract") 1.75 + } 1.76 + slot.put("<br />") 1.77 + end 1.78 + local draft_text = param.get("content") 1.79 + local draft_text = util.wysihtml_preproc(draft_text) 1.80 + ui.field.hidden{ name = "content", value = draft_text } 1.81 + ui.container{ 1.82 + attr = { class = "draft" }, 1.83 + content = function() 1.84 + slot.put(draft_text) 1.85 + end 1.86 + } 1.87 + slot.put("<br />") 1.88 1.89 - slot.put("<br />") 1.90 - ui.tag{ 1.91 - tag = "input", 1.92 - attr = { 1.93 - type = "submit", 1.94 - class = "btn btn-default", 1.95 - value = _'Publish now' 1.96 - }, 1.97 - content = "" 1.98 - } 1.99 - slot.put("<br />") 1.100 - slot.put("<br />") 1.101 + ui.tag{ 1.102 + tag = "input", 1.103 + attr = { 1.104 + type = "submit", 1.105 + class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored", 1.106 + value = _'Publish now' 1.107 + }, 1.108 + content = "" 1.109 + } 1.110 + slot.put(" ") 1.111 + 1.112 + ui.tag{ 1.113 + tag = "input", 1.114 + attr = { 1.115 + type = "submit", 1.116 + name = "edit", 1.117 + class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect", 1.118 + value = _'Edit again' 1.119 + }, 1.120 + content = "" 1.121 + } 1.122 + slot.put(" ") 1.123 1.124 - ui.tag{ 1.125 - tag = "input", 1.126 - attr = { 1.127 - type = "submit", 1.128 - name = "edit", 1.129 - class = "btn-link", 1.130 - value = _'Edit again' 1.131 - }, 1.132 - content = "" 1.133 - } 1.134 - slot.put(" | ") 1.135 - ui.link{ 1.136 - content = _"Cancel", 1.137 - module = "initiative", 1.138 - view = "show", 1.139 - id = initiative.id 1.140 - } 1.141 - end ) 1.142 + ui.link{ 1.143 + attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" }, 1.144 + content = _"Cancel", 1.145 + module = "initiative", 1.146 + view = "show", 1.147 + id = initiative.id 1.148 + } 1.149 + end ) 1.150 1.151 - else 1.152 - ui.sectionRow( function() 1.153 - execute.view{ module = "initiative", view = "_sidebar_wikisyntax" } 1.154 - 1.155 - if not config.enforce_formatting_engine then 1.156 - ui.field.select{ 1.157 - label = _"Wiki engine", 1.158 - name = "formatting_engine", 1.159 - foreign_records = config.formatting_engines, 1.160 - attr = {id = "formatting_engine"}, 1.161 - foreign_id = "id", 1.162 - foreign_name = "name" 1.163 - } 1.164 - end 1.165 - 1.166 - ui.heading{ level = 2, content = _"Enter your proposal and/or reasons" } 1.167 + else 1.168 + ui.sectionRow( function() 1.169 + if config.initiative_abstract then 1.170 + ui.container { content = _"Enter abstract:" } 1.171 + ui.container{ attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield__fullwidth" }, content = function() 1.172 + ui.field.text{ 1.173 + name = "abstract", 1.174 + multiline = true, 1.175 + attr = { id = "abstract", style = "height: 20ex; width: 100%;" }, 1.176 + value = param.get("abstract") 1.177 + } 1.178 + end } 1.179 + end 1.180 + 1.181 + ui.container { content = _"Enter your proposal and/or reasons:" } 1.182 + ui.field.wysihtml{ 1.183 + name = "content", 1.184 + multiline = true, 1.185 + attr = { id = "draft", style = "height: 50ex; width: 100%;" }, 1.186 + value = param.get("content") 1.187 + } 1.188 + if not issue or issue.state == "admission" or issue.state == "discussion" then 1.189 + ui.container { content = _"You can change your text again anytime during admission and discussion phase" } 1.190 + else 1.191 + ui.container { content = _"You cannot change your text again later, because this issue is already in verfication phase!" } 1.192 + end 1.193 + slot.put("<br />") 1.194 1.195 - ui.field.text{ 1.196 - name = "content", 1.197 - multiline = true, 1.198 - attr = { style = "height: 50ex; width: 100%;" }, 1.199 - value = param.get("content") 1.200 - } 1.201 - ui.tag{ 1.202 - tag = "input", 1.203 - attr = { 1.204 - type = "submit", 1.205 - name = "preview", 1.206 - class = "btn btn-default", 1.207 - value = _'Preview' 1.208 - }, 1.209 - content = "" 1.210 - } 1.211 - slot.put("<br />") 1.212 - slot.put("<br />") 1.213 - 1.214 - ui.link{ 1.215 - content = _"Cancel", 1.216 - module = "initiative", 1.217 - view = "show", 1.218 - id = initiative.id 1.219 - } 1.220 - 1.221 - end ) 1.222 - end 1.223 + ui.tag{ 1.224 + tag = "input", 1.225 + attr = { 1.226 + type = "submit", 1.227 + name = "preview", 1.228 + class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored", 1.229 + value = _'Preview' 1.230 + }, 1.231 + content = "" 1.232 + } 1.233 + slot.put(" ") 1.234 + 1.235 + ui.link{ 1.236 + content = _"Cancel", 1.237 + module = "initiative", 1.238 + view = "show", 1.239 + id = initiative.id, 1.240 + attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" } 1.241 + } 1.242 + 1.243 + end ) 1.244 + end 1.245 + end } 1.246 + end } 1.247 + end } 1.248 + end } 1.249 end 1.250 }