liquid_feedback_frontend
diff app/main/member/_sidebar_contacts.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
| author | bsw |
|---|---|
| date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
| parents | |
| children | 8be69c8d99a8 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/member/_sidebar_contacts.lua Thu Jul 10 01:19:48 2014 +0200 1.3 @@ -0,0 +1,86 @@ 1.4 +local member = param.get("member", "table") 1.5 + 1.6 +local public_contacts_selector = Contact:build_selector{ 1.7 + public = true, 1.8 + member_id = member.id, 1.9 + order = "name" 1.10 +} 1.11 + 1.12 +local private_contacts_selector = Contact:build_selector{ 1.13 + public = false, 1.14 + member_id = member.id, 1.15 + order = "name" 1.16 +} 1.17 + 1.18 +ui.sidebar( "tab-members", function() 1.19 + 1.20 + ui.sidebarHead( function() 1.21 + ui.heading { level = 2, content = _"Published contacts" } 1.22 + end ) 1.23 + 1.24 + --ui.sidebarSection( function() 1.25 + 1.26 + if public_contacts_selector:count() == 0 then 1.27 + ui.sidebarSection( function() 1.28 + ui.field.text{ value = _"No published contacts" } 1.29 + end ) 1.30 + else 1.31 + ui.paginate{ 1.32 + selector = public_contacts_selector, 1.33 + name = "contacts", 1.34 + content = function() 1.35 + local contacts = public_contacts_selector:exec() 1.36 + for i, contact in ipairs(contacts) do 1.37 + ui.sidebarSection( "sidebarRowNarrow", function() 1.38 + execute.view{ module = "member_image", view = "_show", params = { 1.39 + member_id = contact.other_member.id, class = "micro_avatar", 1.40 + popup_text = contact.other_member.name, 1.41 + image_type = "avatar", show_dummy = true, 1.42 + } } 1.43 + slot.put(" ") 1.44 + ui.link{ 1.45 + content = contact.other_member.name, 1.46 + module = "member", 1.47 + view = "show", 1.48 + id = contact.other_member.id 1.49 + } 1.50 + end ) 1.51 + end 1.52 + end 1.53 + } 1.54 + end 1.55 + --end ) 1.56 + 1.57 + 1.58 + if member.id == app.session.member.id and private_contacts_selector:count() > 0 then 1.59 + 1.60 + ui.sidebarHead( function() 1.61 + ui.heading { level = 2, content = _"Private contacts" } 1.62 + end ) 1.63 + 1.64 + ui.paginate{ 1.65 + selector = private_contacts_selector, 1.66 + name = "contacts", 1.67 + content = function() 1.68 + local contacts = private_contacts_selector:exec() 1.69 + for i, contact in ipairs(contacts) do 1.70 + ui.sidebarSection( "sidebarRowNarrow", function() 1.71 + execute.view{ module = "member_image", view = "_show", params = { 1.72 + member_id = contact.other_member.id, class = "micro_avatar", 1.73 + popup_text = contact.other_member.name, 1.74 + image_type = "avatar", show_dummy = true, 1.75 + } } 1.76 + slot.put(" ") 1.77 + ui.link{ 1.78 + content = contact.other_member.name, 1.79 + module = "member", 1.80 + view = "show", 1.81 + id = contact.other_member.id 1.82 + } 1.83 + end ) 1.84 + end 1.85 + end 1.86 + } 1.87 + 1.88 + end 1.89 +end ) 1.90 \ No newline at end of file