liquid_feedback_frontend
diff app/main/member/_profile.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 | 254661fb5d83 | 
| children | ce812dccaac2 | 
   line diff
1.1 --- a/app/main/member/_profile.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/member/_profile.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -2,20 +2,13 @@ 1.4 1.5 local for_registration = param.get("for_registration", atom.boolean) 1.6 1.7 -if not member then 1.8 - local member_id = param.get("member_id", atom.integer) 1.9 - if member_id then 1.10 - member = Member:by_id(member_id) 1.11 - end 1.12 -end 1.13 - 1.14 ui.form{ 1.15 attr = { class = "form" }, 1.16 record = member, 1.17 readonly = true, 1.18 content = function() 1.19 1.20 - if not for_registration then 1.21 + if not for_registration and MemberImage:by_pk(member.id, "photo", true) then 1.22 ui.container { attr = { class = "member_photo" }, content = function() 1.23 execute.view{ 1.24 module = "member_image", 1.25 @@ -42,60 +35,15 @@ 1.26 if for_registration and member.notify_email then 1.27 ui.field.text{ label = _"Notification email", name = "notify_email" } 1.28 end 1.29 - 1.30 - if member.realname and #member.realname > 0 then 1.31 - ui.field.text{ label = _"Real name", name = "realname" } 1.32 - end 1.33 - if member.email and #member.email > 0 then 1.34 - ui.field.text{ label = _"email", name = "email" } 1.35 - end 1.36 - if member.xmpp_address and #member.xmpp_address > 0 then 1.37 - ui.field.text{ label = _"xmpp", name = "xmpp_address" } 1.38 - end 1.39 - if member.website and #member.website > 0 then 1.40 - ui.field.text{ label = _"Website", name = "website" } 1.41 - end 1.42 - if member.phone and #member.phone > 0 then 1.43 - ui.field.text{ label = _"Phone", name = "phone" } 1.44 - end 1.45 - if member.mobile_phone and #member.mobile_phone > 0 then 1.46 - ui.field.text{ label = _"Mobile phone", name = "mobile_phone" } 1.47 + if member.profile then 1.48 + local profile = member.profile.profile or {} 1.49 + for i, field in ipairs(config.member_profile_fields) do 1.50 + if profile[field.id] and #(profile[field.id]) > 0 then 1.51 + ui.field.text{ label = field.name, name = field.id, value = profile[field.id] } 1.52 + end 1.53 + end 1.54 end 1.55 - if member.address and #member.address > 0 then 1.56 - ui.container{ 1.57 - content = function() 1.58 - ui.tag{ 1.59 - tag = "label", 1.60 - attr = { class = "ui_field_label" }, 1.61 - content = _"Address" 1.62 - } 1.63 - ui.tag{ 1.64 - tag = "span", 1.65 - content = function() 1.66 - slot.put(encode.html_newlines(encode.html(member.address))) 1.67 - end 1.68 - } 1.69 - end 1.70 - } 1.71 - end 1.72 - if member.profession and #member.profession > 0 then 1.73 - ui.field.text{ label = _"Profession", name = "profession" } 1.74 - end 1.75 - if member.birthday and #member.birthday > 0 then 1.76 - ui.field.text{ label = _"Birthday", name = "birthday" } 1.77 - end 1.78 - if member.organizational_unit and #member.organizational_unit > 0 then 1.79 - ui.field.text{ label = _"Organizational unit", name = "organizational_unit" } 1.80 - end 1.81 - if member.internal_posts and #member.internal_posts > 0 then 1.82 - ui.field.text{ label = _"Internal posts", name = "internal_posts" } 1.83 - end 1.84 - if member.external_memberships and #member.external_memberships > 0 then 1.85 - ui.field.text{ label = _"Memberships", name = "external_memberships", multiline = true } 1.86 - end 1.87 - if member.external_posts and #member.external_posts > 0 then 1.88 - ui.field.text{ label = _"Posts", name = "external_posts", multiline = true } 1.89 - end 1.90 + 1.91 if member.admin then 1.92 ui.field.boolean{ label = _"Admin?", name = "admin" } 1.93 end 1.94 @@ -105,13 +53,13 @@ 1.95 if member.last_activity then 1.96 ui.field.text{ label = _"Last activity (updated daily)", value = format.date(member.last_activity) or _"not yet" } 1.97 end 1.98 - if member.id and member.statement and #member.statement > 0 then 1.99 + if member.profile and member.profile.statement and #member.profile.statement > 0 then 1.100 slot.put("<br />") 1.101 slot.put("<br />") 1.102 ui.container{ 1.103 attr = { class = " wiki" }, 1.104 content = function() 1.105 - slot.put(member:get_content("html")) 1.106 + slot.put(member.profile:get_content("html")) 1.107 end 1.108 } 1.109 end