WIP added a share view, tests are red
This commit is contained in:
parent
7e838fc778
commit
469d5b99a2
6 changed files with 50 additions and 4 deletions
|
|
@ -37,4 +37,8 @@ class ContactsController < ApplicationController
|
|||
redirect_to contact.person
|
||||
end
|
||||
|
||||
def sharing
|
||||
@contacts = current_user.contacts.sharing
|
||||
#render :nothing => true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
28
app/views/contacts/sharing.haml
Normal file
28
app/views/contacts/sharing.haml
Normal file
|
|
@ -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)
|
||||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue