link a user to featured users if user has zero contacts
This commit is contained in:
parent
3d88095ba2
commit
756a20ecd4
7 changed files with 56 additions and 8 deletions
|
|
@ -3,9 +3,6 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module ApplicationHelper
|
||||
|
||||
|
||||
|
||||
def how_long_ago(obj)
|
||||
timeago(obj.created_at)
|
||||
end
|
||||
|
|
@ -122,4 +119,12 @@ module ApplicationHelper
|
|||
t('aspects.index.your_aspects')
|
||||
end
|
||||
end
|
||||
|
||||
def contacts_link
|
||||
if current_user.contacts.size > 0
|
||||
contacts_path
|
||||
else
|
||||
featured_users_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
%br
|
||||
%br
|
||||
= t('.try_adding_some_more_contacts')
|
||||
!= t('.or_featured', :link => link_to(t(".featured_users") , featured_path))
|
||||
!= t('.or_featured', :link => link_to(t(".featured_users") , featured_users_path))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
= person_image_link person
|
||||
|
||||
- if all_aspects_selected? || @aspect_ids.size > 1
|
||||
= link_to t('.view_all_contacts'), contacts_path, :id => "view_all_contacts_link"
|
||||
= link_to t('.view_all_contacts'), contacts_link, :id => "view_all_contacts_link"
|
||||
- else
|
||||
= link_to t('.view_all_contacts'), contacts_path(:a_id => @aspect.id), :id => "view_all_contacts_link"
|
||||
|
||||
- else
|
||||
= t('.no_contacts')
|
||||
= link_to t('.manage_your_aspects'), contacts_path
|
||||
= link_to t('.manage_your_aspects'), contacts_link
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
= image_tag 'icons/home_grey.svg', :height => 16
|
||||
|
||||
#contacts_badge.badge
|
||||
= link_to contacts_path, :title => t('_contacts') do
|
||||
= link_to contacts_link, :title => t('_contacts') do
|
||||
= image_tag 'icons/contacts_grey.svg', :height => 16
|
||||
|
||||
#notification_badge.badge
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ Diaspora::Application.routes.draw do
|
|||
resources :aspect_memberships, :only => [:destroy, :create, :update]
|
||||
resources :post_visibilities, :only => [:update]
|
||||
|
||||
get 'featured' => "contacts#featured"
|
||||
get 'featured' => "contacts#featured", :as => 'featured_users'
|
||||
resources :people, :except => [:edit, :update] do
|
||||
resources :status_messages
|
||||
resources :photos
|
||||
|
|
|
|||
|
|
@ -46,3 +46,28 @@ Feature: User manages contacts
|
|||
|
||||
When I scroll down
|
||||
Then I should see 60 contacts
|
||||
|
||||
|
||||
Scenario: clicking on the contacts link in the header with zero contacts directs a user to the featured users page
|
||||
Given I am signed in
|
||||
And I have 0 contacts
|
||||
And I am on the home page
|
||||
|
||||
When I follow "Contacts"
|
||||
Then I should see "Featured Users" within ".span-18"
|
||||
|
||||
Scenario: clicking on the manage aspects link in the right nav with zero contacts directs a user to the featured users page
|
||||
Given I am signed in
|
||||
And I have 0 contacts
|
||||
And I am on the home page
|
||||
|
||||
When I follow "Manage your aspects."
|
||||
Then I should see "Featured Users" within ".span-18"
|
||||
|
||||
Scenario: clicking on the contacts link in the header with contacts does not send a user to the featured users page
|
||||
Given I am signed in
|
||||
And I have 2 contacts
|
||||
And I am on the home page
|
||||
|
||||
When I follow "Contacts"
|
||||
Then I should not see "Featured Users" within "#section_header"
|
||||
|
|
|
|||
|
|
@ -59,4 +59,22 @@ describe ApplicationHelper do
|
|||
person_link(@person).should_not include("<h1>")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#contacts_link" do
|
||||
before do
|
||||
def current_user
|
||||
@current_user
|
||||
end
|
||||
end
|
||||
|
||||
it 'links to featured users' do
|
||||
@current_user = Factory(:user)
|
||||
contacts_link.should == featured_users_path
|
||||
end
|
||||
|
||||
it 'links to contacts#index' do
|
||||
@current_user = alice
|
||||
contacts_link.should == contacts_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue