fix for comment listing
This commit is contained in:
@@ -63,14 +63,14 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index_by_post
|
def index_by_post
|
||||||
@posts = Post.commented_before(Time.now).tag_match(params[:tags]).paginate(params[:page], :limit => 5)
|
@posts = Post.commented_before(Time.now).tag_match(params[:tags]).order("posts.id desc").paginate(params[:page], :limit => 5)
|
||||||
respond_with(@posts) do |format|
|
respond_with(@posts) do |format|
|
||||||
format.html {render :action => "index_by_post"}
|
format.html {render :action => "index_by_post"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_by_comment
|
def index_by_comment
|
||||||
@comments = Comment.search(params[:search]).paginate(params[:page])
|
@comments = Comment.search(params[:search]).order("comments.id desc").paginate(params[:page])
|
||||||
respond_with(@comments) do |format|
|
respond_with(@comments) do |format|
|
||||||
format.html {render :action => "index_by_comment"}
|
format.html {render :action => "index_by_comment"}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Comment < ActiveRecord::Base
|
|||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def recent
|
def recent
|
||||||
order("comments.id desc").limit(6)
|
reorder("comments.id desc").limit(6)
|
||||||
end
|
end
|
||||||
|
|
||||||
def body_matches(query)
|
def body_matches(query)
|
||||||
@@ -51,7 +51,7 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
if params[:creator_name].present?
|
if params[:creator_name].present?
|
||||||
q = q.for_user_name(params[:creator_name])
|
q = q.for_creator_name(params[:creator_name])
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:creator_id].present?
|
if params[:creator_id].present?
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="preview">
|
<div class="preview">
|
||||||
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent, :show_header => true %>
|
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent.reverse, :show_header => true %>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user