liquid_feedback_frontend
changeset 1488:ce812dccaac2
Work without configured profile fields
author | bsw |
---|---|
date | Mon Jan 07 19:16:30 2019 +0100 (2019-01-07) |
parents | ad1107fc0fbf |
children | 3ab878ba277e |
files | app/main/member/_profile.lua app/main/member/edit.lua |
line diff
1.1 --- a/app/main/member/_profile.lua Mon Jan 07 19:15:42 2019 +0100 1.2 +++ b/app/main/member/_profile.lua Mon Jan 07 19:16:30 2019 +0100 1.3 @@ -37,9 +37,11 @@ 1.4 end 1.5 if member.profile then 1.6 local profile = member.profile.profile or {} 1.7 - for i, field in ipairs(config.member_profile_fields) do 1.8 - if profile[field.id] and #(profile[field.id]) > 0 then 1.9 - ui.field.text{ label = field.name, name = field.id, value = profile[field.id] } 1.10 + if config.member_profile_fields then 1.11 + for i, field in ipairs(config.member_profile_fields) do 1.12 + if profile[field.id] and #(profile[field.id]) > 0 then 1.13 + ui.field.text{ label = field.name, name = field.id, value = profile[field.id] } 1.14 + end 1.15 end 1.16 end 1.17 end
2.1 --- a/app/main/member/edit.lua Mon Jan 07 19:15:42 2019 +0100 2.2 +++ b/app/main/member/edit.lua Mon Jan 07 19:16:30 2019 +0100 2.3 @@ -27,16 +27,17 @@ 2.4 2.5 ui.container{ content = _"All fields are optional. Please enter only data which should be published." } 2.6 2.7 - for i, field in ipairs(config.member_profile_fields) do 2.8 - ui.container{ 2.9 - attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" }, 2.10 - content = function() 2.11 - 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 } } 2.12 - ui.tag{ tag = "label", attr = { class = "mdl-textfield__label", ["for"] = "input_" .. field.id }, content = field.name } 2.13 - end } 2.14 - slot.put("<br />") 2.15 + if config.member_profile_fields then 2.16 + for i, field in ipairs(config.member_profile_fields) do 2.17 + ui.container{ 2.18 + attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" }, 2.19 + content = function() 2.20 + 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 } } 2.21 + ui.tag{ tag = "label", attr = { class = "mdl-textfield__label", ["for"] = "input_" .. field.id }, content = field.name } 2.22 + end } 2.23 + slot.put("<br />") 2.24 + end 2.25 end 2.26 - 2.27 if not config.enforce_formatting_engine then 2.28 ui.field.select{ 2.29 label = _"Wiki engine for statement",