diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb
index ae131c2..3e39cd9 100644
--- a/app/helpers/blog_helper.rb
+++ b/app/helpers/blog_helper.rb
@@ -20,7 +20,7 @@ module BlogHelper
:previous_label => _('« Newer posts'),
:next_label => _('Older posts »'),
:params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"}
- })
+ }) if articles.present?
content = []
artic_len = articles.length
articles.each_with_index{ |art,i|
diff --git a/app/helpers/content_viewer_helper.rb b/app/helpers/content_viewer_helper.rb
index 821e094..b24c01a 100644
--- a/app/helpers/content_viewer_helper.rb
+++ b/app/helpers/content_viewer_helper.rb
@@ -2,7 +2,6 @@ module ContentViewerHelper
include BlogHelper
include ForumHelper
- include ActionView::Helpers::TagHelper
def number_of_comments(article)
n = article.comments.without_spam.count
diff --git a/app/models/article.rb b/app/models/article.rb
index 9feef3e..a806117 100644
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -2,6 +2,9 @@ require 'hpricot'
class Article < ActiveRecord::Base
+ #FIXME This is necessary because html is being generated on the model...
+ include ActionView::Helpers::TagHelper
+
# use for internationalizable human type names in search facets
# reimplement on subclasses
def self.type_name
diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml
index 20bafe8..31c7e75 100644
--- a/app/views/content_viewer/view_page.rhtml
+++ b/app/views/content_viewer/view_page.rhtml
@@ -90,7 +90,7 @@
<% end %>
<% if @page.accept_comments? && @comments_count > 1 %>
- <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') %>
+ <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button') %>
<% end %>
diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb
index cfc500b..0e5a994 100644
--- a/test/functional/content_viewer_controller_test.rb
+++ b/test/functional/content_viewer_controller_test.rb
@@ -1281,7 +1281,7 @@ end
comment = article.comments.build(:author => profile, :title => 'hi', :body => 'hello')
comment.save!
get :view_page, :profile => 'testuser', :page => [ 'test' ]
- assert_no_tag :tag => 'a', :attributes => { :class => 'display-comment-form' }
+ assert_no_tag :tag => 'a', :attributes => { :id => 'top-post-comment-button' }
end
should 'not show a post comment button on top if there are no comments' do
@@ -1289,7 +1289,7 @@ end
article = profile.articles.build(:name => 'test')
article.save!
get :view_page, :profile => 'testuser', :page => [ 'test' ]
- assert_no_tag :tag => 'a', :attributes => { :class => 'display-comment-form' }
+ assert_no_tag :tag => 'a', :attributes => { :id => 'top-post-comment-button' }
end
should 'show a post comment button on top if there are at least two comments' do
@@ -1301,7 +1301,7 @@ end
comment2 = article.comments.build(:author => profile, :title => 'hi', :body => 'hello', :reply_of_id => comment1.id)
comment2.save!
get :view_page, :profile => 'testuser', :page => [ 'test' ]
- assert_tag :tag => 'a', :attributes => { :class => 'display-comment-form' }
+ assert_tag :tag => 'a', :attributes => { :id => 'top-post-comment-button' }
end
should 'store number of comments' do
diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb
index 4a2a2ac..5c60f07 100644
--- a/test/functional/environment_design_controller_test.rb
+++ b/test/functional/environment_design_controller_test.rb
@@ -64,11 +64,8 @@ class EnvironmentDesignControllerTest < ActionController::TestCase
e.boxes.first.blocks << l
community = mock()
Environment.any_instance.stubs(:portal_community).returns(community)
- article = mock()
+ article = fast_create(Article)
community.stubs(:articles).returns([article])
- article.expects(:folder?).returns(false)
- article.expects(:path).returns('some_path')
- article.expects(:id).returns(1)
get :edit, :id => l.id
assert_tag :tag => 'select', :attributes => { :name => 'block[article_id]' }
end
diff --git a/test/unit/content_viewer_helper_test.rb b/test/unit/content_viewer_helper_test.rb
index fd977d5..c4add70 100644
--- a/test/unit/content_viewer_helper_test.rb
+++ b/test/unit/content_viewer_helper_test.rb
@@ -61,8 +61,7 @@ class ContentViewerHelperTest < ActiveSupport::TestCase
end
should 'count total of comments from post' do
- article = fast_create(TextileArticle)
- article.stubs(:url).returns({})
+ article = fast_create(TextileArticle, :profile_id => profile.id)
article.comments.create!(:author => profile, :title => 'test', :body => 'test')
result = link_to_comments(article)
assert_match /One comment/, result
--
libgit2 0.21.2