liquid_feedback_frontend
diff app/main/member/edit.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 | 701a5cf6b067 |
| children | ce812dccaac2 |
line diff
1.1 --- a/app/main/member/edit.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/member/edit.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -1,117 +1,122 @@ 1.4 ui.titleMember(_"Edit your profile data") 1.5 1.6 -execute.view { 1.7 - module = "member", view = "_sidebar_whatcanido", params = { 1.8 - member = app.session.member 1.9 - } 1.10 -} 1.11 +local profile = app.session.member.profile 1.12 + 1.13 +ui.grid{ content = function() 1.14 + ui.cell_main{ content = function() 1.15 1.16 -ui.form{ 1.17 - record = app.session.member, 1.18 - attr = { class = "vertical" }, 1.19 - module = "member", 1.20 - action = "update", 1.21 - routing = { 1.22 - ok = { 1.23 - mode = "redirect", 1.24 - module = "member", 1.25 - view = "show", 1.26 - id = app.session.member_id 1.27 - } 1.28 - }, 1.29 - content = function() 1.30 - 1.31 - ui.section( function() 1.32 - 1.33 - ui.sectionHead( function() 1.34 - ui.heading{ level = 1, content = _"Edit your profile data" } 1.35 - end ) 1.36 - 1.37 - ui.sectionRow( _"All fields are optional. Please enter only data which should be published." ) 1.38 - 1.39 - ui.sectionRow( function() 1.40 - 1.41 - ui.field.text{ label = _"Organizational unit", name = "organizational_unit", readonly = config.locked_profile_fields.organizational_unit } 1.42 - ui.field.text{ label = _"Internal posts", name = "internal_posts", readonly = config.locked_profile_fields.internal_posts } 1.43 - ui.field.text{ label = _"Real name", name = "realname", readonly = config.locked_profile_fields.realname } 1.44 - ui.field.text{ label = _"Birthday" .. " YYYY-MM-DD ", name = "birthday", attr = { id = "profile_birthday" }, readonly = config.locked_profile_fields.birthday } 1.45 - ui.script{ static = "gregor.js/gregor.js" } 1.46 - util.gregor("profile_birthday", "document.getElementById('timeline_search_date').form.submit();") 1.47 - ui.field.text{ label = _"Address", name = "address", multiline = true, readonly = config.locked_profile_fields.address } 1.48 - ui.field.text{ label = _"email", name = "email", readonly = config.locked_profile_fields.email } 1.49 - ui.field.text{ label = _"xmpp", name = "xmpp_address", readonly = config.locked_profile_fields.xmpp_address } 1.50 - ui.field.text{ label = _"Website", name = "website", readonly = config.locked_profile_fields.website } 1.51 - ui.field.text{ label = _"Phone", name = "phone", readonly = config.locked_profile_fields.phone } 1.52 - ui.field.text{ label = _"Mobile phone", name = "mobile_phone", readonly = config.locked_profile_fields.mobile_phone } 1.53 - ui.field.text{ label = _"Profession", name = "profession", readonly = config.locked_profile_fields.profession } 1.54 - ui.field.text{ label = _"External memberships", name = "external_memberships", multiline = true, readonly = config.locked_profile_fields.external_memberships } 1.55 - ui.field.text{ label = _"External posts", name = "external_posts", multiline = true, readonly = config.locked_profile_fields.external_posts } 1.56 + ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.57 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.58 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Edit your profile data" } 1.59 + end } 1.60 + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.61 + ui.form{ 1.62 + record = profile, 1.63 + attr = { class = "vertical" }, 1.64 + module = "member", 1.65 + action = "update", 1.66 + routing = { 1.67 + ok = { 1.68 + mode = "redirect", 1.69 + module = "member", 1.70 + view = "show", 1.71 + id = app.session.member_id 1.72 + } 1.73 + }, 1.74 + content = function() 1.75 + 1.76 + ui.container{ content = _"All fields are optional. Please enter only data which should be published." } 1.77 + 1.78 + for i, field in ipairs(config.member_profile_fields) do 1.79 + ui.container{ 1.80 + attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" }, 1.81 + content = function() 1.82 + ui.tag{ tag = "input", attr = { class = "mdl-textfield__input", name = field.id, id = "input_" .. field.id, readonly = config.locked_profile_fields[field.id], value = profile and profile.profile and profile.profile[field.id] or nil } } 1.83 + ui.tag{ tag = "label", attr = { class = "mdl-textfield__label", ["for"] = "input_" .. field.id }, content = field.name } 1.84 + end } 1.85 + slot.put("<br />") 1.86 + end 1.87 1.88 - if not config.enforce_formatting_engine then 1.89 - ui.field.select{ 1.90 - label = _"Wiki engine for statement", 1.91 - name = "formatting_engine", 1.92 - foreign_records = config.formatting_engines, 1.93 - attr = {id = "formatting_engine"}, 1.94 - foreign_id = "id", 1.95 - foreign_name = "name", 1.96 - value = param.get("formatting_engine") 1.97 - } 1.98 - ui.tag{ 1.99 - tag = "div", 1.100 - content = function() 1.101 - ui.tag{ 1.102 - tag = "label", 1.103 - attr = { class = "ui_field_label" }, 1.104 - content = function() slot.put(" ") end, 1.105 + if not config.enforce_formatting_engine then 1.106 + ui.field.select{ 1.107 + label = _"Wiki engine for statement", 1.108 + name = "formatting_engine", 1.109 + foreign_records = config.formatting_engines, 1.110 + attr = {id = "formatting_engine"}, 1.111 + foreign_id = "id", 1.112 + foreign_name = "name", 1.113 + value = param.get("formatting_engine") 1.114 } 1.115 ui.tag{ 1.116 + tag = "div", 1.117 content = function() 1.118 - ui.link{ 1.119 - text = _"Syntax help", 1.120 - module = "help", 1.121 - view = "show", 1.122 - id = "wikisyntax", 1.123 - attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.124 + ui.tag{ 1.125 + tag = "label", 1.126 + attr = { class = "ui_field_label" }, 1.127 + content = function() slot.put(" ") end, 1.128 } 1.129 - slot.put(" ") 1.130 - ui.link{ 1.131 - text = _"(new window)", 1.132 - module = "help", 1.133 - view = "show", 1.134 - id = "wikisyntax", 1.135 - attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.136 + ui.tag{ 1.137 + content = function() 1.138 + ui.link{ 1.139 + text = _"Syntax help", 1.140 + module = "help", 1.141 + view = "show", 1.142 + id = "wikisyntax", 1.143 + attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.144 + } 1.145 + slot.put(" ") 1.146 + ui.link{ 1.147 + text = _"(new window)", 1.148 + module = "help", 1.149 + view = "show", 1.150 + id = "wikisyntax", 1.151 + attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} 1.152 + } 1.153 + end 1.154 } 1.155 end 1.156 } 1.157 end 1.158 - } 1.159 - end 1.160 - ui.field.text{ 1.161 - label = _"Statement", 1.162 - name = "statement", 1.163 - multiline = true, 1.164 - attr = { style = "height: 50ex;" }, 1.165 - value = param.get("statement") 1.166 + ui.field.text{ 1.167 + label = _"Statement", 1.168 + name = "statement", 1.169 + multiline = true, 1.170 + attr = { style = "height: 50ex;" }, 1.171 + value = param.get("statement") 1.172 + } 1.173 + slot.put("<br />") 1.174 + ui.container{ attr = { class = "actions" }, content = function() 1.175 + ui.tag{ 1.176 + tag = "input", 1.177 + attr = { 1.178 + type = "submit", 1.179 + class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect", 1.180 + value = _"publish profile data" 1.181 + }, 1.182 + content = "" 1.183 + } 1.184 + slot.put(" ") 1.185 + ui.link{ 1.186 + attr = { 1.187 + class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect", 1.188 + }, 1.189 + content = _"cancel", 1.190 + module = "member", view = "show", id = app.session.member.id 1.191 + } 1.192 + end } 1.193 + end 1.194 } 1.195 - slot.put("<br />") 1.196 - ui.container{ attr = { class = "actions" }, content = function() 1.197 - ui.tag{ 1.198 - tag = "input", 1.199 - attr = { 1.200 - type = "submit", 1.201 - class = "btn btn-default", 1.202 - value = _"publish profile data" 1.203 - }, 1.204 - content = "" 1.205 - } 1.206 - slot.put("<br /><br /><br />") 1.207 - ui.link{ 1.208 - content = _"cancel", 1.209 - module = "member", view = "show", id = app.session.member.id 1.210 - } 1.211 - end } 1.212 - end ) 1.213 - end ) 1.214 - end 1.215 -} 1.216 \ No newline at end of file 1.217 + 1.218 + end } 1.219 + end } 1.220 + end } 1.221 + 1.222 + ui.cell_sidebar{ content = function() 1.223 + execute.view { 1.224 + module = "member", view = "_sidebar_whatcanido", params = { 1.225 + member = app.session.member 1.226 + } 1.227 + } 1.228 + end } 1.229 + 1.230 +end }