Merge pull request #3173 from evazion/fix-3152
Fix #3152: Differentiate <div> ID's on comments controller
This commit is contained in:
@@ -81,7 +81,6 @@ private
|
|||||||
@posts = Post.where("last_comment_bumped_at IS NOT NULL").tag_match(params[:tags]).reorder("last_comment_bumped_at DESC NULLS LAST").paginate(params[:page], :limit => 5, :search_count => params[:search])
|
@posts = Post.where("last_comment_bumped_at IS NOT NULL").tag_match(params[:tags]).reorder("last_comment_bumped_at DESC NULLS LAST").paginate(params[:page], :limit => 5, :search_count => params[:search])
|
||||||
@posts.each # hack to force rails to eager load
|
@posts.each # hack to force rails to eager load
|
||||||
respond_with(@posts) do |format|
|
respond_with(@posts) do |format|
|
||||||
format.html {render :action => "index_by_post"}
|
|
||||||
format.xml do
|
format.xml do
|
||||||
render :xml => @posts.to_xml(:root => "posts")
|
render :xml => @posts.to_xml(:root => "posts")
|
||||||
end
|
end
|
||||||
@@ -91,10 +90,8 @@ private
|
|||||||
def index_by_comment
|
def index_by_comment
|
||||||
@comments = Comment.search(params[:search]).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
@comments = Comment.search(params[:search]).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
||||||
respond_with(@comments) do |format|
|
respond_with(@comments) do |format|
|
||||||
format.html {render :action => "index_by_comment"}
|
|
||||||
format.atom do
|
format.atom do
|
||||||
@comments = @comments.includes(:post, :creator).load
|
@comments = @comments.includes(:post, :creator).load
|
||||||
render :action => "index"
|
|
||||||
end
|
end
|
||||||
format.xml do
|
format.xml do
|
||||||
render :xml => @comments.to_xml(:root => "comments")
|
render :xml => @comments.to_xml(:root => "comments")
|
||||||
|
|||||||
21
app/views/comments/_index_by_comment.html.erb
Normal file
21
app/views/comments/_index_by_comment.html.erb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<div id="p-index-by-comment" class="comments-for-post">
|
||||||
|
<div class="list-of-comments">
|
||||||
|
<% @comments.each do |comment| %>
|
||||||
|
<% if CurrentUser.is_moderator? || !comment.is_deleted? %>
|
||||||
|
<div id="post_<%= comment.post.id %>" class="post <%= PostPresenter.preview_class(comment.post) %>" <%= PostPresenter.data_attributes(comment.post) %>>
|
||||||
|
<div class="preview">
|
||||||
|
<% if comment.post.visible? %>
|
||||||
|
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<%= render :partial => "comments/partials/show/comment", :collection => [comment] %>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= numbered_paginator(@comments) %>
|
||||||
|
|
||||||
|
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: params[:search]), title: "Comments")) %>
|
||||||
29
app/views/comments/_index_by_post.html.erb
Normal file
29
app/views/comments/_index_by_post.html.erb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<div id="p-index-by-post">
|
||||||
|
<% if !CurrentUser.user.is_builder? %>
|
||||||
|
<div style="margin-bottom: 1em;">
|
||||||
|
<h2>Before commenting, read the <%= link_to "how to comment guide", wiki_pages_path(:search => {:title => "howto:comment"}) %>.</h2>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if @posts.empty? %>
|
||||||
|
<%= render "post_sets/blank" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% @posts.select {|x| x.visible?}.each do |post| %>
|
||||||
|
<% if CurrentUser.is_moderator? || post.comments.undeleted.exists? %>
|
||||||
|
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
||||||
|
<div class="preview">
|
||||||
|
<% if post.visible? %>
|
||||||
|
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent.reverse, :show_header => true %>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= numbered_paginator(@posts) %>
|
||||||
|
|
||||||
|
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: { do_not_bump_post: true }), title: "Comments")) %>
|
||||||
19
app/views/comments/index.html.erb
Normal file
19
app/views/comments/index.html.erb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<div id="c-comments">
|
||||||
|
<div id="a-index">
|
||||||
|
<h1>Comments</h1>
|
||||||
|
|
||||||
|
<%= render "posts/partials/common/inline_blacklist" %>
|
||||||
|
|
||||||
|
<% if params[:group_by] == "comment" %>
|
||||||
|
<%= render "index_by_comment" %>
|
||||||
|
<% else %>
|
||||||
|
<%= render "index_by_post" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render "comments/secondary_links" %>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Comments - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<div id="c-comments">
|
|
||||||
<div id="a-index">
|
|
||||||
<h1>Comments</h1>
|
|
||||||
|
|
||||||
<%= render "posts/partials/common/inline_blacklist" %>
|
|
||||||
|
|
||||||
<div class="comments-for-post">
|
|
||||||
<div class="list-of-comments">
|
|
||||||
<% @comments.each do |comment| %>
|
|
||||||
<% if CurrentUser.is_moderator? || !comment.is_deleted? %>
|
|
||||||
<div id="post_<%= comment.post.id %>" class="post <%= PostPresenter.preview_class(comment.post) %>" <%= PostPresenter.data_attributes(comment.post) %>>
|
|
||||||
<div class="preview">
|
|
||||||
<% if comment.post.visible? %>
|
|
||||||
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<%= render :partial => "comments/partials/show/comment", :collection => [comment] %>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= numbered_paginator(@comments) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "comments/secondary_links" %>
|
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
|
||||||
Comments - <%= Danbooru.config.app_name %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: params[:search]), title: "Comments")) %>
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<div id="c-comments">
|
|
||||||
<div id="a-index">
|
|
||||||
<h1>Comments</h1>
|
|
||||||
|
|
||||||
<%= render "posts/partials/common/inline_blacklist" %>
|
|
||||||
|
|
||||||
<% if !CurrentUser.user.is_builder? %>
|
|
||||||
<div style="margin-bottom: 1em;">
|
|
||||||
<h2>Before commenting, read the <%= link_to "how to comment guide", wiki_pages_path(:search => {:title => "howto:comment"}) %>.</h2>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @posts.empty? %>
|
|
||||||
<%= render "post_sets/blank" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% @posts.select {|x| x.visible?}.each do |post| %>
|
|
||||||
<% if CurrentUser.is_moderator? || post.comments.undeleted.exists? %>
|
|
||||||
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
|
||||||
<div class="preview">
|
|
||||||
<% if post.visible? %>
|
|
||||||
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent.reverse, :show_header => true %>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= numbered_paginator(@posts) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "comments/secondary_links" %>
|
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
|
||||||
Comments - <%= Danbooru.config.app_name %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: { do_not_bump_post: true }), title: "Comments")) %>
|
|
||||||
Reference in New Issue
Block a user