Commit 874e1575e3683ffe953ee26565933776d0026c91

Authored by Rodrigo Souto
2 parents 1b2a4981 f36e4843

Merge branch 'merge-requests/344' into stable

g wrong happens with comment creation

Conflicts:
	public/javascripts/comment_form.js
app/controllers/public/content_viewer_controller.rb
... ... @@ -100,9 +100,9 @@ class ContentViewerController < ApplicationController
100 100 end
101 101  
102 102 @comments = @page.comments.without_spam
  103 + @comments = @plugins.filter(:unavailable_comments, @comments)
103 104 @comments_count = @comments.count
104   - @comments = @plugins.filter(:unavailable_comments, @comments.without_reply)
105   - @comments = @comments.paginate(:per_page => per_page, :page => params[:comment_page] )
  105 + @comments = @comments.without_reply.paginate(:per_page => per_page, :page => params[:comment_page] )
106 106  
107 107 if params[:slideshow]
108 108 render :action => 'slideshow', :layout => 'slideshow'
... ...
public/javascripts/comment_form.js
... ... @@ -54,7 +54,7 @@ function save_comment(button) {
54 54 $('#'+ data.render_target).replaceWith(data.html);
55 55 $('#' + data.render_target).effect("highlight", {}, 3000);
56 56 $.colorbox.close();
57   - update_comment_count();
  57 + increment_comment_count(comment_div);
58 58 } else {
59 59 //New comment of article
60 60 comment_div.find('.article-comments-list').append(data.html);
... ... @@ -65,7 +65,7 @@ function save_comment(button) {
65 65  
66 66 page_comment_form.find('.errorExplanation').remove();
67 67 $.colorbox.close();
68   - update_comment_count();
  68 + increment_comment_count(comment_div);
69 69 }
70 70  
71 71 if(jQuery('#recaptcha_response_field').val()){
... ... @@ -83,12 +83,11 @@ function save_comment(button) {
83 83 }, 'json');
84 84 }
85 85  
86   -function update_comment_count() {
  86 +function increment_comment_count(comment_div) {
87 87 comment_div.find('.comment-count').add('#article-header .comment-count').each(function() {
88   - var count = parseInt($(this).html());
89   - update_comment_count($(this), count + 1);
  88 + var count = parseInt(jQuery(this).html());
  89 + update_comment_count(jQuery(this), count + 1);
90 90 });
91   -
92 91 }
93 92  
94 93 function show_display_comment_button() {
... ...