From 1109658e8320996a9f5f32646d07140151fb5583 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 19 Jun 2013 07:38:14 -0400 Subject: [PATCH 1/4] Show the user if a contact is sharing with them when viewing their profile page. --- app/views/people/_profile_sidebar.html.haml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 10bb9764f..0d91324af 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -5,6 +5,11 @@ #profile .profile_photo = person_image_link(person, :size => :thumb_large, :to => :photos) + - if contact.sharing? + .info + = image_tag('icons/check_yes_ok.png') + = person.name + is sharing with you - if user_signed_in? - if person != current_user.person From f7cceecb524b2bb6c11873236c226ea01c213a2f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 19 Jun 2013 22:03:37 -0400 Subject: [PATCH 2/4] Add PeopleHelper#sharing_message method and english localized message text. --- app/helpers/people_helper.rb | 9 +++++++++ config/locales/diaspora/en.yml | 1 + spec/helpers/people_helper_spec.rb | 22 +++++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index ef751f1c5..c823f4a8e 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -87,4 +87,13 @@ module PeopleHelper return Rails.application.routes.url_helpers.person_path(person, opts) end end + + def sharing_message(person, contact) + if contact.sharing? + content_tag(:div, :class => 'info') do + image_tag('icons/check_yes_ok.png') + + content_tag(:span, I18n.t('people.helper.is_sharing', :name => person.name)) + end + end + end end diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 1efd46ebf..6cb20ab04 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -593,6 +593,7 @@ en: helper: results_for: " results for %{params}" people_on_pod_are_aware_of: " people on pod are aware of" + is_sharing: "%{name} is sharing with you" aspect_list: edit_membership: "edit aspect membership" add_contact_small: diff --git a/spec/helpers/people_helper_spec.rb b/spec/helpers/people_helper_spec.rb index b8713e1da..e5e61f43e 100644 --- a/spec/helpers/people_helper_spec.rb +++ b/spec/helpers/people_helper_spec.rb @@ -117,5 +117,25 @@ describe PeopleHelper do local_or_remote_person_path(@person).should == person_path(@person) end end -end + describe '#sharing_message' do + before do + @contact = FactoryGirl.create(:contact, :person => @person) + end + + context 'when the contact is sharing' do + it 'shows the sharing message' do + message = I18n.t('people.helper.is_sharing', :name => @person.name) + @contact.stub(:sharing?).and_return(true) + sharing_message(@person, @contact).should include(message) + end + end + + context 'when the contact is not sharing' do + it 'does not show the sharing message' do + @contact.stub(:sharing?).and_return(false) + sharing_message(@person, @contact).should be_blank + end + end + end +end From 1e5ef88d8c9b82e78494e959951aa6b25ae0d6dd Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 19 Jun 2013 22:04:07 -0400 Subject: [PATCH 3/4] Use PeopleHelper#sharing_message view helper method in the profile sidebar. --- app/views/people/_profile_sidebar.html.haml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 0d91324af..4821a0965 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -5,14 +5,11 @@ #profile .profile_photo = person_image_link(person, :size => :thumb_large, :to => :photos) - - if contact.sharing? - .info - = image_tag('icons/check_yes_ok.png') - = person.name - is sharing with you - if user_signed_in? - if person != current_user.person + = sharing_message(@person, @contact) + - if @contact && @contact.receiving? %br = link_to t('people.show.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox' From 2e83736f4329d95537d33707abf31cb048c524ac Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 20 Jun 2013 07:39:56 -0400 Subject: [PATCH 4/4] Add SASS for sharing message. --- app/assets/stylesheets/application.css.sass | 11 +++++++++++ app/helpers/people_helper.rb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass index 262023718..9b7d2609c 100644 --- a/app/assets/stylesheets/application.css.sass +++ b/app/assets/stylesheets/application.css.sass @@ -622,6 +622,17 @@ form.new_comment h4 :font-weight bold + #sharing_message + :font-size smaller + :align middle + + span + :vertical-align middle + + img + :vertical-align middle + :margin 0.5em + #photo_container :text :align center diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index c823f4a8e..bf019f997 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -90,7 +90,7 @@ module PeopleHelper def sharing_message(person, contact) if contact.sharing? - content_tag(:div, :class => 'info') do + content_tag(:div, :id => 'sharing_message') do image_tag('icons/check_yes_ok.png') + content_tag(:span, I18n.t('people.helper.is_sharing', :name => person.name)) end