Commit c4fe95aa93ebf7b19c5b2aaa20240bf5c35b2f59

Authored by Rodrigo Souto
1 parent bf19f3c4

Fixing conflicting link_to_article method signature

app/helpers/application_helper.rb
@@ -951,7 +951,7 @@ module ApplicationHelper @@ -951,7 +951,7 @@ module ApplicationHelper
951 # This method was created to work around to inexplicable 951 # This method was created to work around to inexplicable
952 # chain of problems when display_short_format was called 952 # chain of problems when display_short_format was called
953 # from Article model for an ArticleBlock. 953 # from Article model for an ArticleBlock.
954 - def link_to_article(text, article, anchor=nil) 954 + def reference_to_article(text, article, anchor=nil)
955 if article.profile.domains.empty? 955 if article.profile.domains.empty?
956 href = "/#{article.url[:profile]}/" 956 href = "/#{article.url[:profile]}/"
957 else 957 else
@@ -969,7 +969,7 @@ module ApplicationHelper @@ -969,7 +969,7 @@ module ApplicationHelper
969 article.lead + 969 article.lead +
970 content_tag('div', 970 content_tag('div',
971 (options[:comments_link] ? link_to_comments(article) : '') + 971 (options[:comments_link] ? link_to_comments(article) : '') +
972 - (options[:read_more_link] ? link_to_article( _('Read more'), article) : ''), 972 + (options[:read_more_link] ? reference_to_article( _('Read more'), article) : ''),
973 :class => 'read-more' 973 :class => 'read-more'
974 ), 974 ),
975 :class => 'short-post' 975 :class => 'short-post'
app/helpers/content_viewer_helper.rb
@@ -37,7 +37,7 @@ module ContentViewerHelper @@ -37,7 +37,7 @@ module ContentViewerHelper
37 37
38 def link_to_comments(article, args = {}) 38 def link_to_comments(article, args = {})
39 return '' unless article.accept_comments? 39 return '' unless article.accept_comments?
40 - link_to_article number_of_comments(article), article, 'comments_list' 40 + reference_to_article number_of_comments(article), article, 'comments_list'
41 end 41 end
42 42
43 def article_translations(article) 43 def article_translations(article)
test/unit/application_helper_test.rb
@@ -657,33 +657,33 @@ class ApplicationHelperTest < ActiveSupport::TestCase @@ -657,33 +657,33 @@ class ApplicationHelperTest < ActiveSupport::TestCase
657 assert_not_nil add_zoom_to_images 657 assert_not_nil add_zoom_to_images
658 end 658 end
659 659
660 - should 'link to article' do 660 + should 'reference to article' do
661 c = fast_create(Community) 661 c = fast_create(Community)
662 a = fast_create(TinyMceArticle, :profile_id => c.id) 662 a = fast_create(TinyMceArticle, :profile_id => c.id)
663 assert_equal( 663 assert_equal(
664 "<a href=\"/#{c.identifier}/#{a.slug}\">x</a>", 664 "<a href=\"/#{c.identifier}/#{a.slug}\">x</a>",
665 - link_to_article('x', a) ) 665 + reference_to_article('x', a) )
666 end 666 end
667 667
668 - should 'link to article, with anchor' do 668 + should 'reference to article, with anchor' do
669 c = fast_create(Community) 669 c = fast_create(Community)
670 a = fast_create(TinyMceArticle, :profile_id => c.id) 670 a = fast_create(TinyMceArticle, :profile_id => c.id)
671 assert_equal( 671 assert_equal(
672 "<a href=\"/#{c.identifier}/#{a.slug}#place\">x</a>", 672 "<a href=\"/#{c.identifier}/#{a.slug}#place\">x</a>",
673 - link_to_article('x', a, 'place') ) 673 + reference_to_article('x', a, 'place') )
674 end 674 end
675 675
676 - should 'link to article, in a blog' do 676 + should 'reference to article, in a blog' do
677 c = fast_create(Community) 677 c = fast_create(Community)
678 b = fast_create(Blog, :profile_id => c.id) 678 b = fast_create(Blog, :profile_id => c.id)
679 a = fast_create(TinyMceArticle, :profile_id => c.id, :parent_id => b.id) 679 a = fast_create(TinyMceArticle, :profile_id => c.id, :parent_id => b.id)
680 a.save! # needed to link to the parent blog 680 a.save! # needed to link to the parent blog
681 assert_equal( 681 assert_equal(
682 "<a href=\"/#{c.identifier}/#{b.slug}/#{a.slug}\">x</a>", 682 "<a href=\"/#{c.identifier}/#{b.slug}/#{a.slug}\">x</a>",
683 - link_to_article('x', a) ) 683 + reference_to_article('x', a) )
684 end 684 end
685 685
686 - should 'link to article, in a profile with domain' do 686 + should 'reference to article, in a profile with domain' do
687 c = fast_create(Community) 687 c = fast_create(Community)
688 c.domains << Domain.new(:name=>'domain.xyz') 688 c.domains << Domain.new(:name=>'domain.xyz')
689 b = fast_create(Blog, :profile_id => c.id) 689 b = fast_create(Blog, :profile_id => c.id)
@@ -691,7 +691,7 @@ class ApplicationHelperTest &lt; ActiveSupport::TestCase @@ -691,7 +691,7 @@ class ApplicationHelperTest &lt; ActiveSupport::TestCase
691 a.save! 691 a.save!
692 assert_equal( 692 assert_equal(
693 "<a href=\"http://domain.xyz/#{b.slug}/#{a.slug}\">x</a>", 693 "<a href=\"http://domain.xyz/#{b.slug}/#{a.slug}\">x</a>",
694 - link_to_article('x', a) ) 694 + reference_to_article('x', a) )
695 end 695 end
696 696
697 protected 697 protected