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
|
redirect_to contact.person
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sharing
|
||||||
|
@contacts = current_user.contacts.sharing
|
||||||
|
#render :nothing => true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
%li{:class => ("dull" if @contacts_sharing_with.size == 0)}
|
%li{:class => ("dull" if @contacts_sharing_with.size == 0)}
|
||||||
.right
|
.right
|
||||||
%b
|
%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
|
%b
|
||||||
People sharing with you
|
= t('aspects.index.people_sharing_with_you')
|
||||||
%br
|
%br
|
||||||
|
|
||||||
- if @contacts_sharing_with.size > 0
|
- 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."
|
handle_explanation: "This is your diaspora handle. Like an email address, you can give this to people to reach you."
|
||||||
no_contacts: "No contacts"
|
no_contacts: "No contacts"
|
||||||
post_a_message: "post a message >>"
|
post_a_message: "post a message >>"
|
||||||
|
people_sharing_with_you: "People sharing with you"
|
||||||
|
|
||||||
aspect_memberships:
|
aspect_memberships:
|
||||||
destroy:
|
destroy:
|
||||||
|
|
@ -547,9 +548,9 @@ en:
|
||||||
invitations_left: "(%{count} left)"
|
invitations_left: "(%{count} left)"
|
||||||
dont_have_now: "You don't have any right now, but more invites are coming soon!"
|
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"
|
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"
|
from_facebook: "From Facebook"
|
||||||
by_email: "by Email"
|
by_email: "via Email"
|
||||||
reshare:
|
reshare:
|
||||||
reshare: "Reshare"
|
reshare: "Reshare"
|
||||||
public_explain:
|
public_explain:
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ Diaspora::Application.routes.draw do
|
||||||
|
|
||||||
resource :profile
|
resource :profile
|
||||||
|
|
||||||
|
get 'contacts/sharing' => 'contacts#sharing'
|
||||||
resources :contacts, :except => [:index, :update, :create]
|
resources :contacts, :except => [:index, :update, :create]
|
||||||
resources :aspect_memberships, :only => [:destroy, :create, :update]
|
resources :aspect_memberships, :only => [:destroy, :create, :update]
|
||||||
resources :post_visibilities, :only => [:update]
|
resources :post_visibilities, :only => [:update]
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,16 @@ describe ContactsController do
|
||||||
response.should redirect_to(@contact.person)
|
response.should redirect_to(@contact.person)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue