diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index bb918f7..8ce05c2 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -28,12 +28,11 @@ module BlogHelper content << content_tag('div', display_post(i), :class => 'blog-post' + css_add, :id => "post-#{i.id}") end } - content.join("\n") + (pagination or '') + content.join("\n
\n") + (pagination or '') end def display_post(article) - article_title(article) + content_tag('p', article.to_html) + - content_tag('p', link_to( number_of_comments(article), article.url.merge(:form => 'opened', :anchor => 'comment_form') ), :class => 'metadata') + article_title(article) + content_tag('p', article.to_html) end end diff --git a/app/helpers/content_viewer_helper.rb b/app/helpers/content_viewer_helper.rb index 36db7ff..1bb5b95 100644 --- a/app/helpers/content_viewer_helper.rb +++ b/app/helpers/content_viewer_helper.rb @@ -18,9 +18,9 @@ module ContentViewerHelper title = content_tag('h1', title, :class => 'title') if article.belongs_to_blog? unless args[:no_link] - title = content_tag('h3', link_to(article.name, article.url), :class => 'title') + title = content_tag('h1', link_to(article.name, article.url), :class => 'title') end - title << content_tag('span', _("%s, by %s") % [show_date(article.published_at), link_to(article.author.name, article.author.url)], :class => 'created-at') + title << content_tag('span', _("%s, by %s - %s") % [show_date(article.published_at), link_to(article.author.name, article.author.url), link_to_comments(article)], :class => 'created-at') end title end @@ -31,4 +31,8 @@ module ContentViewerHelper content end + def link_to_comments(article) + link_to( number_of_comments(article), article.url.merge(:form => 'opened', :anchor => 'comments_list') ) + end + end diff --git a/app/views/content_viewer/blog_page.rhtml b/app/views/content_viewer/blog_page.rhtml index 7ec2a36..c191c4f 100644 --- a/app/views/content_viewer/blog_page.rhtml +++ b/app/views/content_viewer/blog_page.rhtml @@ -2,4 +2,6 @@
<%= article.body %>

-<%= (children.compact.empty? ? content_tag('em', _('(no posts)')) : list_posts(user, children)) %> +
+ <%= (children.compact.empty? ? content_tag('em', _('(no posts)')) : list_posts(user, children)) %> +
diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index e46e6f9..5180b3b 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -1,4 +1,12 @@
+
+
+
+
+
+
+
+
<% # AddThis Button @@ -107,6 +115,7 @@ <% end %>
+ <% if @page.accept_comments? %>

> <%= number_of_comments(@page) %> @@ -116,4 +125,6 @@ <% end %>

+
+
diff --git a/app/views/shared/tiny_mce.rhtml b/app/views/shared/tiny_mce.rhtml index c3d9352..4077435 100644 --- a/app/views/shared/tiny_mce.rhtml +++ b/app/views/shared/tiny_mce.rhtml @@ -16,6 +16,7 @@ tinyMCE.init({ theme_advanced_buttons1 : "print,separator,copy,paste,separator,undo,redo,separator,search,replace,separator,fontsizeselect,formatselect", theme_advanced_buttons2 : "bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,table,separator,cleanup,code", theme_advanced_buttons3 : "", + theme_advanced_blockformats :"p,address,pre,h2,h3,h4,h5,h6", paste_auto_cleanup_on_paste : true, paste_insert_word_content_callback : "convertWord", paste_use_dialog: false, diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 642d28f..4df1c94 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -712,7 +712,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase a = Blog.create!(:name => 'article folder', :profile => profile) t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) get :view_page, :profile => profile.identifier, :page => [a.path] - assert_tag :tag => 'div', :attributes => { :id => "post-#{t.id}" }, :descendant => { :tag => 'a', :content => 'No comments yet', :attributes => { :href => /#{profile.identifier}\/blog\/first-post\?form=opened#comment_form/ } } + assert_tag :tag => 'div', :attributes => { :id => "post-#{t.id}" }, :descendant => { :tag => 'a', :content => 'No comments yet', :attributes => { :href => /#{profile.identifier}\/blog\/first-post\?form=opened#comments_list/ } } end should 'hit the article when viewed' do diff --git a/test/unit/blog_helper_test.rb b/test/unit/blog_helper_test.rb index ba9111a..b994a39 100644 --- a/test/unit/blog_helper_test.rb +++ b/test/unit/blog_helper_test.rb @@ -50,10 +50,8 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << article = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => blog, :published => true) expects(:article_title).with(article).returns('TITLE') expects(:content_tag).with('p', article.to_html).returns(' TO_HTML') - expects(:number_of_comments).with(article).returns('NUMBER OF COMMENTS') - expects(:content_tag).with('p', 'NUMBER OF COMMENTS', anything).returns(' COMMENTS').at_least_once - assert_equal 'TITLE TO_HTML COMMENTS', display_post(article) + assert_equal 'TITLE TO_HTML', display_post(article) end def will_paginate(arg1, arg2) diff --git a/test/unit/content_viewer_helper_test.rb b/test/unit/content_viewer_helper_test.rb index 8616085..828c071 100644 --- a/test/unit/content_viewer_helper_test.rb +++ b/test/unit/content_viewer_helper_test.rb @@ -49,7 +49,7 @@ class ContentViewerHelperTest < Test::Unit::TestCase article = TextileArticle.new(:name => 'first post for test', :body => 'first post for test', :profile => profile) article.stubs(:url).returns({}) article.stubs(:comments).returns([Comment.new(:author => profile, :title => 'test', :body => 'test')]) - result = display_post(article) + result = link_to_comments(article) assert_match /One comment/, result end -- libgit2 0.21.2