diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index d7ab53155a8ed381c83065072b69994511941b87..ce464b53e5d13ee24470b3460f32af7999b743d6 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -37,4 +37,8 @@ class ContactsController < ApplicationController redirect_to contact.person end + def sharing + @contacts = current_user.contacts.sharing + #render :nothing => true + end end diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index 7081b1c9fcea0f290e87249f2d4d0b0223fa39c9..8a08fa7ccde3d4b4919097d3e835ccd9aa4a911c 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -16,9 +16,9 @@ %li{:class => ("dull" if @contacts_sharing_with.size == 0)} .right %b - = link_to t('contacts', :count => @contacts_sharing_with.size), edit_aspect_path(aspect), :rel => 'facebox', :class => 'contact-count' + = link_to t('contacts', :count => @contacts_sharing_with.size), contacts_sharing_path, :rel => 'facebox', :class => 'contact-count' %b - People sharing with you + = t('aspects.index.people_sharing_with_you') %br - if @contacts_sharing_with.size > 0 diff --git a/app/views/contacts/sharing.haml b/app/views/contacts/sharing.haml new file mode 100644 index 0000000000000000000000000000000000000000..1d5d79597bfac386384147aa4b1ca1e1503456fc --- /dev/null +++ b/app/views/contacts/sharing.haml @@ -0,0 +1,28 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + +%h4 + .right + = link_to t('contacts', :count => @contact_count), manage_aspects_path, :title => t('aspects.manage.manage_aspects') + + = t('aspects', :count => aspects.count) + +%ul + +/ - for aspect in aspects +/ = render 'aspects/aspect', :aspect => aspect, :contacts => aspect.contacts + +/ - if @contacts_sharing_with +/ %li{:class => ("dull" if @contacts_sharing_with.size == 0)} +/ .right +/ %b +/ = link_to t('contacts', :count => @contacts_sharing_with.size), edit_aspect_path("followers"), :rel => 'facebox', :class => 'contact-count' +/ %b +/ = t('aspects.index.people_sharing_with_you') +/ %br + +/ - if @contacts_sharing_with.size > 0 +/ .contacts +/ - for contact in @contacts_sharing_with[0..15] +/ = person_image_link(contact.person) diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 0711255634c8a159cdf68398452740c2ce6bd1b0..4722bdd6d73d65d72d36a00988e64d842819d121 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -140,6 +140,7 @@ en: handle_explanation: "This is your diaspora handle. Like an email address, you can give this to people to reach you." no_contacts: "No contacts" post_a_message: "post a message >>" + people_sharing_with_you: "People sharing with you" aspect_memberships: destroy: @@ -547,9 +548,9 @@ en: invitations_left: "(%{count} left)" dont_have_now: "You don't have any right now, but more invites are coming soon!" invites_closed: "Invites are currently closed on this Diaspora pod" - invite_your_friends: "Find your friends" + invite_your_friends: "Invite your friends" from_facebook: "From Facebook" - by_email: "by Email" + by_email: "via Email" reshare: reshare: "Reshare" public_explain: diff --git a/config/routes.rb b/config/routes.rb index 3160ab45a6cc7a292120ceeea8e32d0a7706d600..c97396ac549b166a964c94b75afacc087b2ea119 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -69,6 +69,7 @@ Diaspora::Application.routes.draw do resource :profile + get 'contacts/sharing' => 'contacts#sharing' resources :contacts, :except => [:index, :update, :create] resources :aspect_memberships, :only => [:destroy, :create, :update] resources :post_visibilities, :only => [:update] diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index 22b9ba6caa799e1c1c2fbecdd790fdea36120f6e..ddd3cf66a65d45e7a25f0e911a47da6e07f585d3 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -63,4 +63,16 @@ describe ContactsController do response.should redirect_to(@contact.person) end end + + describe '#sharing' do + it "succeeds" do + get :sharing + response.should be_success + end + + it "assigns only the people sharing with you with 'share_with' flag" do + get :sharing, :id => 'share_with' + assigns[:contacts].to_set.should == alice.contacts.sharing.to_set + end + end end