liquid_feedback_frontend

view app/main/member/edit.lua @ 1817:757a87af4c83

Added validation hook for profile updates
author bsw
date Mon Dec 13 11:57:35 2021 +0100 (2021-12-13)
parents 7dcbcbf492e3
children
line source
1 ui.titleMember(_"Edit your profile data")
3 local profile = app.session.member.profile
5 ui.grid{ content = function()
6 ui.cell_main{ content = function()
8 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
9 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
10 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Edit your profile data" }
11 end }
12 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
13 ui.form{
14 record = profile,
15 attr = { class = "vertical" },
16 module = "member",
17 action = "update",
18 routing = {
19 ok = {
20 mode = "redirect",
21 module = "member",
22 view = "show",
23 id = app.session.member_id
24 }
25 },
26 content = function()
28 -- ui.container{ content = _"All fields are optional. Please enter only data which should be published." }
30 if config.member_profile_fields then
31 for i, field in ipairs(config.member_profile_fields) do
32 ui.container{
33 attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
34 content = function()
35 ui.tag{ tag = "input", attr = { class = "mdl-textfield__input", name = field.id, id = "input_" .. field.id, readonly = field.validate_func and "readonly" or nil, value = profile and profile.profile and profile.profile[field.id] or nil } }
36 ui.tag{ tag = "label", attr = { class = "mdl-textfield__label", ["for"] = "input_" .. field.id }, content = field.name }
37 end }
38 slot.put("<br />")
39 end
40 end
41 ui.field.text{
42 label = _"Statement",
43 name = "statement",
44 multiline = true,
45 attr = { style = "height: 50ex;" },
46 value = param.get("statement")
47 }
48 slot.put("<br />")
49 ui.container{ attr = { class = "actions" }, content = function()
50 ui.tag{
51 tag = "input",
52 attr = {
53 type = "submit",
54 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect",
55 value = _"publish profile data"
56 },
57 content = ""
58 }
59 slot.put(" &nbsp; ")
60 ui.link {
61 attr = { class = "mdl-button mdl-js-button" },
62 module = "member", view = "show", id = app.session.member_id,
63 content = _"Cancel"
64 }
65 end }
66 end
67 }
69 end }
70 end }
71 end }
73 ui.cell_sidebar{ content = function()
74 execute.view {
75 module = "member", view = "_sidebar_whatcanido", params = {
76 member = app.session.member
77 }
78 }
79 end }
81 end }

Impressum / About Us