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