liquid_feedback_frontend

view app/main/member/edit.lua @ 1530:94d6843fdc94

Add language chooser to profile page
author bsw
date Mon Sep 21 18:44:25 2020 +0200 (2020-09-21)
parents 3ab878ba277e
children 678c7146f27b
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 = config.locked_profile_fields[field.id], 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 if not config.enforce_formatting_engine then
42 ui.field.select{
43 label = _"Wiki engine for statement",
44 name = "formatting_engine",
45 foreign_records = config.formatting_engines,
46 attr = {id = "formatting_engine"},
47 foreign_id = "id",
48 foreign_name = "name",
49 value = param.get("formatting_engine")
50 }
51 ui.tag{
52 tag = "div",
53 content = function()
54 ui.tag{
55 tag = "label",
56 attr = { class = "ui_field_label" },
57 content = function() slot.put("&nbsp;") end,
58 }
59 ui.tag{
60 content = function()
61 ui.link{
62 text = _"Syntax help",
63 module = "help",
64 view = "show",
65 id = "wikisyntax",
66 attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
67 }
68 slot.put(" ")
69 ui.link{
70 text = _"(new window)",
71 module = "help",
72 view = "show",
73 id = "wikisyntax",
74 attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
75 }
76 end
77 }
78 end
79 }
80 end
81 ui.field.text{
82 label = _"Statement",
83 name = "statement",
84 multiline = true,
85 attr = { style = "height: 50ex;" },
86 value = param.get("statement")
87 }
88 slot.put("<br />")
89 ui.container{ attr = { class = "actions" }, content = function()
90 ui.tag{
91 tag = "input",
92 attr = {
93 type = "submit",
94 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect",
95 value = _"publish profile data"
96 },
97 content = ""
98 }
99 slot.put(" &nbsp; ")
100 ui.link{
101 attr = {
102 class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect",
103 },
104 content = _"cancel",
105 module = "member", view = "show", id = app.session.member.id
106 }
107 end }
108 end
109 }
111 end }
112 end }
113 end }
115 ui.cell_sidebar{ content = function()
116 execute.view {
117 module = "member", view = "_sidebar_whatcanido", params = {
118 member = app.session.member
119 }
120 }
121 end }
123 end }

Impressum / About Us