diff --git a/app/assets/stylesheets/specific/comments.css.scss b/app/assets/stylesheets/specific/comments.css.scss index 92f4e15e6..41878a45b 100644 --- a/app/assets/stylesheets/specific/comments.css.scss +++ b/app/assets/stylesheets/specific/comments.css.scss @@ -76,7 +76,10 @@ div#c-comments { div.preview { float: left; - width: 180px; + width: 150px; + height: 150px; + margin-right: 30px; + overflow: hidden; } div.post { diff --git a/app/assets/stylesheets/specific/posts.css.scss b/app/assets/stylesheets/specific/posts.css.scss index 8ebd3eb92..2edd769f4 100644 --- a/app/assets/stylesheets/specific/posts.css.scss +++ b/app/assets/stylesheets/specific/posts.css.scss @@ -114,9 +114,7 @@ div#c-posts { padding: 0.25em 0.5em; &.active { - background-color: $menu_color; font-weight: bold; - @include border-radius(4px); } } } diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index c89487dd1..35fe39884 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -13,21 +13,22 @@ class PostPresenter < Presenter html = %{
} html << %{} - - if post.is_image? && post.image_width > post.image_height && post.image_width.to_i > Danbooru.config.small_image_width - ratio = Danbooru.config.small_image_width.to_f / post.image_height.to_f - offset = ((ratio * post.image_width) - Danbooru.config.small_image_width).to_i / 2 - margin = "-#{offset}px" - else - margin = 0 - end - - html << %{#{h(post.tag_string)}} + html << %{#{h(post.tag_string)}} html << %{} html << %{
} html.html_safe end + def self.margin(post) + if post.is_image? && post.image_width > post.image_height && post.image_width.to_i > Danbooru.config.small_image_width + ratio = Danbooru.config.small_image_width.to_f / post.image_height.to_f + offset = ((ratio * post.image_width) - Danbooru.config.small_image_width).to_i / 2 + return "-#{offset}px" + else + return 0 + end + end + def initialize(post) @post = post end diff --git a/app/views/comments/index_by_post.html.erb b/app/views/comments/index_by_post.html.erb index e520ff501..b8b8bf309 100644 --- a/app/views/comments/index_by_post.html.erb +++ b/app/views/comments/index_by_post.html.erb @@ -9,7 +9,7 @@ <% @posts.each do |post| %>
- <%= link_to(image_tag(post.preview_file_url), post_path(post)) %> + <%= link_to(image_tag(post.preview_file_url, :style => "margin-left: #{PostPresenter.margin(post)};"), post_path(post)) %>
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent, :show_header => true %>