From 4de5e7eee79e4988012df3ab91ad3559eb2da897 Mon Sep 17 00:00:00 2001 From: Toks Date: Sun, 28 Apr 2013 08:36:55 -0400 Subject: [PATCH] fixes #1458 --- app/presenters/post_presenter.rb | 19 +++++++++++-------- app/views/comments/index_by_comment.html.erb | 2 +- app/views/comments/index_by_post.html.erb | 2 +- app/views/comments/show.html.erb | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 1d671ced9..5c2a704c3 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -14,14 +14,7 @@ class PostPresenter < Presenter path = options[:path_prefix] || "/posts" - klass = "post-preview" - klass << " post-status-pending" if post.is_pending? - klass << " post-status-flagged" if post.is_flagged? - klass << " post-status-deleted" if post.is_deleted? - klass << " post-status-has-parent" if post.parent_id - klass << " post-status-has-children" if post.has_children? - - html = %{
} + html = %{
} if options[:tags].present? tag_param = "?tags=#{CGI::escape(options[:tags])}" elsif options[:pool_id] @@ -36,6 +29,16 @@ class PostPresenter < Presenter html.html_safe end + def self.preview_class(post) + klass = "post-preview" + klass << " post-status-pending" if post.is_pending? + klass << " post-status-flagged" if post.is_flagged? + klass << " post-status-deleted" if post.is_deleted? + klass << " post-status-has-parent" if post.parent_id + klass << " post-status-has-children" if post.has_children? + klass + end + def initialize(post) @post = post end diff --git a/app/views/comments/index_by_comment.html.erb b/app/views/comments/index_by_comment.html.erb index 23ca07281..b01dcf98f 100644 --- a/app/views/comments/index_by_comment.html.erb +++ b/app/views/comments/index_by_comment.html.erb @@ -5,7 +5,7 @@
<% @comments.each do |comment| %> -
+
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
diff --git a/app/views/comments/index_by_post.html.erb b/app/views/comments/index_by_post.html.erb index 85b475d93..0e8ae5eb0 100644 --- a/app/views/comments/index_by_post.html.erb +++ b/app/views/comments/index_by_post.html.erb @@ -7,7 +7,7 @@ <% end %> <% @posts.select {|x| Danbooru.config.can_user_see_post?(CurrentUser.user, x)}.each do |post| %> -
+
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb index f78ba1a33..ea44acf37 100644 --- a/app/views/comments/show.html.erb +++ b/app/views/comments/show.html.erb @@ -2,7 +2,7 @@
-
+
<%= link_to(image_tag(@comment.post.preview_file_url), post_path(@comment.post)) %>