Add PeopleHelper#sharing_message method and english localized message text.
This commit is contained in:
parent
1109658e83
commit
f7cceecb52
3 changed files with 31 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue