liquid_feedback_frontend
view app/main/member/_sidebar_contacts.lua @ 1293:9b4ae2beb0e2
German translations added
| author | bsw | 
|---|---|
| date | Mon Apr 18 11:11:00 2016 +0200 (2016-04-18) | 
| parents | 8be69c8d99a8 | 
| children | 32cc544d5a5b | 
 line source
     1 local member = param.get("member", "table")
     3 local public_contacts_selector = Contact:build_selector{
     4   public = true,
     5   member_id = member.id,
     6   order = "name"
     7 }
     9 local private_contacts_selector = Contact:build_selector{
    10   public = false,
    11   member_id = member.id,
    12   order = "name"
    13 }
    15 ui.sidebar( "tab-members", function()
    17   ui.sidebarHead( function()
    18     ui.heading { level = 2, content = _"Published contacts" }
    19   end )
    21   --ui.sidebarSection( function()
    23     if public_contacts_selector:count() == 0 then
    24       ui.sidebarSection( function()
    25         ui.field.text{ value = _"No published contacts" }
    26       end )
    27     else
    28       ui.paginate{
    29         selector = public_contacts_selector,
    30         name = "contacts",
    31         content = function()
    32           local contacts = public_contacts_selector:exec()
    33           for i, contact in ipairs(contacts) do
    34             ui.sidebarSection( "sidebarRowNarrow", function()
    35               execute.view{ module = "member_image", view = "_show", params = {
    36                 member_id = contact.other_member.id, class = "micro_avatar", 
    37                 popup_text = contact.other_member.name,
    38                 image_type = "avatar", show_dummy = true,
    39               } }
    40               slot.put(" ")
    41               ui.link{
    42                 content = contact.other_member.name,
    43                 module = "member",
    44                 view = "show",
    45                 id = contact.other_member.id
    46               }
    47             end )
    48           end
    49         end
    50       }
    51     end
    52   --end )
    55   if app.session.member_id and app.session.member_id == member.id 
    56     and private_contacts_selector:count() > 0
    57   then
    59     ui.sidebarHead( function()
    60       ui.heading { level = 2, content = _"Private contacts" }
    61     end )
    63     ui.paginate{
    64       selector = private_contacts_selector,
    65       name = "contacts",
    66       content = function()
    67         local contacts = private_contacts_selector:exec()
    68         for i, contact in ipairs(contacts) do
    69           ui.sidebarSection( "sidebarRowNarrow", function()
    70             execute.view{ module = "member_image", view = "_show", params = {
    71               member_id = contact.other_member.id, class = "micro_avatar", 
    72               popup_text = contact.other_member.name,
    73               image_type = "avatar", show_dummy = true,
    74             } }
    75             slot.put(" ")
    76             ui.link{
    77               content = contact.other_member.name,
    78               module = "member",
    79               view = "show",
    80               id = contact.other_member.id
    81             }
    82           end )
    83         end
    84       end
    85     }
    87   end
    88 end )
