[Git][noosfero/noosfero][master] 2 commits: profile-image-helper: ensure empty hash on links_for_balloon
Rodrigo Souto
gitlab at mg.gitlab.com
Tue Jul 11 15:22:04 BRT 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
e56672b5 by Rodrigo Souto at 2017-07-06T17:46:45-03:00
profile-image-helper: ensure empty hash on links_for_balloon
- - - - -
a198c378 by Rodrigo Souto at 2017-07-11T18:21:52+00:00
Merge branch 'link_for_balloon' into 'master'
profile-image-helper: ensure empty hash on links_for_balloon
See merge request !1248
- - - - -
2 changed files:
- app/helpers/profile_image_helper.rb
- test/unit/profile_image_helper_test.rb
Changes:
=====================================
app/helpers/profile_image_helper.rb
=====================================
--- a/app/helpers/profile_image_helper.rb
+++ b/app/helpers/profile_image_helper.rb
@@ -66,7 +66,7 @@ module ProfileImageHelper
def links_for_balloon(profile)
if environment.enabled?(:show_balloon_with_profile_links_when_clicked)
if profile.kind_of?(Person)
- [
+ return [
{_('Wall') => {:href => url_for(profile.public_profile_url)}},
{_('Friends') => {:href => url_for(:controller => :profile, :action => :friends, :profile => profile.identifier)}},
{_('Communities') => {:href => url_for(:controller => :profile, :action => :communities, :profile => profile.identifier)}},
@@ -74,7 +74,7 @@ module ProfileImageHelper
{_('Add') => {:href => url_for(profile.add_url), :class => 'add-friend', :style => 'display: none'}}
]
elsif profile.kind_of?(Community)
- [
+ return [
{_('Wall') => {:href => url_for(profile.public_profile_url)}},
{_('Members') => {:href => url_for(:controller => :profile, :action => :members, :profile => profile.identifier)}},
{_('Agenda') => {:href => url_for(:controller => :profile, :action => :events, :profile => profile.identifier)}},
@@ -83,15 +83,14 @@ module ProfileImageHelper
{_('Send an e-mail') => {:href => url_for(:profile => profile.identifier, :controller => 'contact', :action => 'new'), :class => 'send-an-email', :style => 'display: none'}}
]
elsif profile.kind_of?(Enterprise)
- [
+ return [
{_('Members') => {:href => url_for(:controller => :profile, :action => :members, :profile => profile.identifier)}},
{_('Agenda') => {:href => url_for(:controller => :profile, :action => :events, :profile => profile.identifier)}},
{_('Send an e-mail') => {:href => url_for(:profile => profile.identifier, :controller => 'contact', :action => 'new'), :class => 'send-an-email', :style => 'display: none'}},
]
- else
- []
end
end
+ []
end
include StyleHelper
=====================================
test/unit/profile_image_helper_test.rb
=====================================
--- a/test/unit/profile_image_helper_test.rb
+++ b/test/unit/profile_image_helper_test.rb
@@ -36,7 +36,7 @@ class ProfileImageHelperTest < ActionView::TestCase
env.stubs(:enabled?).with(:show_balloon_with_profile_links_when_clicked).returns(false)
stubs(:environment).returns(env)
profile = Profile.new
- assert_nil links_for_balloon(profile)
+ assert_empty links_for_balloon(profile)
end
should 'return ordered list of links to balloon to Person' do
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/70b12d62d752f0ea391fc1143b0331ef0d970c0b...a198c378bb0d44f51ac0c1565b98d31ae4bda34f
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/70b12d62d752f0ea391fc1143b0331ef0d970c0b...a198c378bb0d44f51ac0c1565b98d31ae4bda34f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170711/e47f2953/attachment-0001.html>
More information about the Noosfero-dev
mailing list