From 7339e46bfb5ddb5b1d2867c94c495fcbc8e7c98e Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 28 Jan 2011 16:40:35 -0800 Subject: [PATCH] Moving remote friend view out to a partial --- app/views/services/_remote_friend.html.haml | 35 +++++++++++++++++++ app/views/services/finder.html.haml | 38 +-------------------- 2 files changed, 36 insertions(+), 37 deletions(-) create mode 100644 app/views/services/_remote_friend.html.haml diff --git a/app/views/services/_remote_friend.html.haml b/app/views/services/_remote_friend.html.haml new file mode 100644 index 000000000..800970cf3 --- /dev/null +++ b/app/views/services/_remote_friend.html.haml @@ -0,0 +1,35 @@ +%li + .right + -if friend[:contact] && !friend[:contact].pending + = t('people.person.already_connected') + - elsif (friend[:contact] && friend[:contact].pending) + = t('people.person.pending_request') + - elsif friend[:invitation_id] + = t('invitations.new.already_invited') + %br + = link_to t('.resend'), service_inviter_path(:uid => uid, :provider => 'facebook', :invitation_id => friend[:invitation_id]) + - elsif friend[:person] + = link_to t('people.show.start_sharing'), + {:controller => "people", + :action => "show", + :id => friend[:person].id, + :share_with => true}, + :class => 'button' + + - elsif current_user.invites > 0 + = form_tag service_inviter_path do + = select_tag(:aspect_id, options_from_collection_for_select(@all_aspects, 'id', 'name')) + = hidden_field_tag :uid, uid + = hidden_field_tag :provider, 'facebook' + = submit_tag t('.invite') + + - if friend[:person] + = person_image_link(friend[:person]) + - else + = image_tag('/images/user/default.png', :class => 'avatar') + + %h4.name + - if friend[:person] + = link_to friend[:name], person_path(friend[:person]) + - else + = friend[:name] diff --git a/app/views/services/finder.html.haml b/app/views/services/finder.html.haml index a0a6ab4aa..8a3f3d069 100644 --- a/app/views/services/finder.html.haml +++ b/app/views/services/finder.html.haml @@ -21,43 +21,7 @@ = search_field_tag :contact_search, "", :class => 'contact_list_search', :results => 5, :placeholder => t('shared.contact_list.all_contacts') %ul - for uid in @friends.keys - - friend = @friends[uid] - %li - .right - -if friend[:contact] && !friend[:contact].pending - = t('people.person.already_connected') - - elsif (friend[:contact] && friend[:contact].pending) - = t('people.person.pending_request') - - elsif friend[:invitation_id] - = t('invitations.new.already_invited') - %br - = link_to t('.resend'), service_inviter_path(:uid => uid, :provider => 'facebook', :invitation_id => friend[:invitation_id]) - - elsif friend[:person] - = link_to t('people.show.start_sharing'), - {:controller => "people", - :action => "show", - :id => friend[:person].id, - :share_with => true}, - :class => 'button' - - - elsif current_user.invites > 0 - = form_tag service_inviter_path do - = select_tag(:aspect_id, options_from_collection_for_select(@all_aspects, 'id', 'name')) - = hidden_field_tag :uid, uid - = hidden_field_tag :provider, 'facebook' - = submit_tag t('.invite') - - - if friend[:person] - = person_image_link(friend[:person]) - - else - = image_tag('/images/user/default.png', :class => 'avatar') - - %h4.name - - if friend[:person] - = link_to friend[:name], person_path(friend[:person]) - - else - = friend[:name] - + = render :partial => 'remote_person', :friend => @friends[uid], :uid => uid - else %br %br