liquid_feedback_frontend
diff app/main/suggestion/new.lua @ 1479:00d281ba3099
New layout for suggestion add dialog
author | bsw |
---|---|
date | Thu Oct 18 17:56:58 2018 +0200 (2018-10-18) |
parents | 701a5cf6b067 |
children | ce00a6d5f610 |
line diff
1.1 --- a/app/main/suggestion/new.lua Thu Oct 18 17:54:48 2018 +0200 1.2 +++ b/app/main/suggestion/new.lua Thu Oct 18 17:56:58 2018 +0200 1.3 @@ -1,106 +1,111 @@ 1.4 local initiative_id = param.get("initiative_id") 1.5 1.6 -ui.form{ 1.7 - module = "suggestion", 1.8 - action = "add", 1.9 - params = { initiative_id = initiative_id }, 1.10 - routing = { 1.11 - default = { 1.12 - mode = "redirect", 1.13 - module = "initiative", 1.14 - view = "show", 1.15 - id = initiative_id, 1.16 - params = { tab = "suggestions" } 1.17 - } 1.18 - }, 1.19 - attr = { class = "section vertical" }, 1.20 - content = function() 1.21 - 1.22 - ui.sectionHead( function() 1.23 - ui.heading { level = 1, content = _"Add a new suggestion for improvement" } 1.24 - end) 1.25 - 1.26 - ui.sectionRow( function() 1.27 - 1.28 - local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false 1.29 - if not supported then 1.30 - ui.field.text{ 1.31 - attr = { class = "warning" }, 1.32 - value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter." 1.33 - } 1.34 - end 1.35 - ui.field.text{ label = _"A short title (80 chars max)", name = "name" } 1.36 - 1.37 - if not config.enforce_formatting_engine then 1.38 - ui.field.select{ 1.39 - label = _"Wiki engine", 1.40 - name = "formatting_engine", 1.41 - foreign_records = config.formatting_engines, 1.42 - attr = {id = "formatting_engine"}, 1.43 - foreign_id = "id", 1.44 - foreign_name = "name", 1.45 - value = param.get("formatting_engine") 1.46 - } 1.47 - ui.tag{ 1.48 - tag = "div", 1.49 +ui.grid{ content = function() 1.50 + 1.51 + ui.cell_main{ content = function() 1.52 + ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.53 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.54 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Add a new suggestion for improvement" } 1.55 + end } 1.56 + ui.container{ attr = { class = "mdl-card__content" }, content = function() 1.57 + ui.form{ 1.58 + module = "suggestion", 1.59 + action = "add", 1.60 + params = { initiative_id = initiative_id }, 1.61 + routing = { 1.62 + default = { 1.63 + mode = "redirect", 1.64 + module = "initiative", 1.65 + view = "show", 1.66 + id = initiative_id, 1.67 + params = { tab = "suggestions" } 1.68 + } 1.69 + }, 1.70 + attr = { class = "section vertical" }, 1.71 content = function() 1.72 - ui.tag{ 1.73 - tag = "label", 1.74 - attr = { class = "ui_field_label" }, 1.75 - content = function() slot.put(" ") end, 1.76 + 1.77 + local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false 1.78 + if not supported then 1.79 + ui.field.text{ 1.80 + attr = { class = "warning" }, 1.81 + value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter." 1.82 + } 1.83 + end 1.84 + ui.field.text{ label = _"A short title (80 chars max)", name = "name" } 1.85 + 1.86 + if not config.enforce_formatting_engine then 1.87 + ui.field.select{ 1.88 + label = _"Wiki engine", 1.89 + name = "formatting_engine", 1.90 + foreign_records = config.formatting_engines, 1.91 + attr = {id = "formatting_engine"}, 1.92 + foreign_id = "id", 1.93 + foreign_name = "name", 1.94 + value = param.get("formatting_engine") 1.95 + } 1.96 + ui.tag{ 1.97 + tag = "div", 1.98 + content = function() 1.99 + ui.tag{ 1.100 + tag = "label", 1.101 + attr = { class = "ui_field_label" }, 1.102 + content = function() slot.put(" ") end, 1.103 + } 1.104 + ui.tag{ 1.105 + content = function() 1.106 + ui.link{ 1.107 + text = _"Syntax help", 1.108 + module = "help", 1.109 + view = "show", 1.110 + id = "wikisyntax", 1.111 + attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.112 + } 1.113 + slot.put(" ") 1.114 + ui.link{ 1.115 + text = _"(new window)", 1.116 + module = "help", 1.117 + view = "show", 1.118 + id = "wikisyntax", 1.119 + attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.120 + } 1.121 + end 1.122 + } 1.123 + end 1.124 + } 1.125 + end 1.126 + 1.127 + ui.field.text{ 1.128 + label = _"Describe how the proposal and/or the reasons of the initiative could be improved", 1.129 + name = "content", 1.130 + multiline = true, 1.131 + attr = { style = "height: 50ex;" }, 1.132 + value = param.get("content") 1.133 } 1.134 - ui.tag{ 1.135 - content = function() 1.136 - ui.link{ 1.137 - text = _"Syntax help", 1.138 - module = "help", 1.139 - view = "show", 1.140 - id = "wikisyntax", 1.141 - attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.142 - } 1.143 - slot.put(" ") 1.144 - ui.link{ 1.145 - text = _"(new window)", 1.146 - module = "help", 1.147 - view = "show", 1.148 - id = "wikisyntax", 1.149 - attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.150 - } 1.151 - end 1.152 + 1.153 + ui.field.select{ 1.154 + label = _"How important is your suggestions for you?", 1.155 + name = "degree", 1.156 + foreign_records = { 1.157 + { id = 1, name = _"should be implemented"}, 1.158 + { id = 2, name = _"must be implemented"}, 1.159 + }, 1.160 + foreign_id = "id", 1.161 + foreign_name = "name" 1.162 } 1.163 + 1.164 + ui.submit{ text = _"publish suggestion" } 1.165 + slot.put(" ") 1.166 + ui.link{ 1.167 + content = _"cancel", 1.168 + module = "initiative", 1.169 + view = "show", 1.170 + id = initiative_id, 1.171 + params = { tab = "suggestions" } 1.172 + } 1.173 + 1.174 end 1.175 } 1.176 - end 1.177 - 1.178 - ui.field.text{ 1.179 - label = _"Describe how the proposal and/or the reasons of the initiative could be improved", 1.180 - name = "content", 1.181 - multiline = true, 1.182 - attr = { style = "height: 50ex;" }, 1.183 - value = param.get("content") 1.184 - } 1.185 - 1.186 - ui.field.select{ 1.187 - label = _"How important is your suggestions for you?", 1.188 - name = "degree", 1.189 - foreign_records = { 1.190 - { id = 1, name = _"should be implemented"}, 1.191 - { id = 2, name = _"must be implemented"}, 1.192 - }, 1.193 - foreign_id = "id", 1.194 - foreign_name = "name" 1.195 - } 1.196 - 1.197 - ui.submit{ text = _"publish suggestion" } 1.198 - slot.put(" ") 1.199 - ui.link{ 1.200 - content = _"cancel", 1.201 - module = "initiative", 1.202 - view = "show", 1.203 - id = initiative_id, 1.204 - params = { tab = "suggestions" } 1.205 - } 1.206 - 1.207 - end ) 1.208 - end 1.209 -} 1.210 + end } 1.211 + end } 1.212 + end } 1.213 +end }