fix
This commit is contained in:
@@ -13,7 +13,7 @@ class PostPresenter < Presenter
|
|||||||
|
|
||||||
html = %{<article class="post-preview" id="post_#{post.id}" data-id="#{post.id}" data-tags="#{h(post.tag_string)}" data-uploader="#{h(post.uploader_name)}" data-rating="#{post.rating}" data-width="#{post.image_width}" data-height="#{post.image_height}" data-flags="#{flags.join(' ')}" data-parent-id="#{post.parent_id}" data-has-children="#{post.has_children?}">}
|
html = %{<article class="post-preview" id="post_#{post.id}" data-id="#{post.id}" data-tags="#{h(post.tag_string)}" data-uploader="#{h(post.uploader_name)}" data-rating="#{post.rating}" data-width="#{post.image_width}" data-height="#{post.image_height}" data-flags="#{flags.join(' ')}" data-parent-id="#{post.parent_id}" data-has-children="#{post.has_children?}">}
|
||||||
html << %{<a href="#{path}/#{post.id}">}
|
html << %{<a href="#{path}/#{post.id}">}
|
||||||
html << %{<img style="margin-left: #{margin_left(post)}; margin-top: #{margin_top(post)}" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
|
html << %{<img style="margin-left: #{margin_left(post)}; margin-top: #{margin_top(post)};" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
|
||||||
html << %{</a>}
|
html << %{</a>}
|
||||||
html << %{</article>}
|
html << %{</article>}
|
||||||
html.html_safe
|
html.html_safe
|
||||||
@@ -23,7 +23,7 @@ class PostPresenter < Presenter
|
|||||||
if post.is_image? && post.image_height > post.image_width && post.image_height < 2 * post.image_width && post.image_height
|
if post.is_image? && post.image_height > post.image_width && post.image_height < 2 * post.image_width && post.image_height
|
||||||
ratio = Danbooru.config.small_image_width.to_f / post.image_width.to_f
|
ratio = Danbooru.config.small_image_width.to_f / post.image_width.to_f
|
||||||
offset = ((ratio * post.image_height) - Danbooru.config.small_image_width).to_i / 2
|
offset = ((ratio * post.image_height) - Danbooru.config.small_image_width).to_i / 2
|
||||||
return "-#{offset}px"
|
return "#{offset}px"
|
||||||
else
|
else
|
||||||
0
|
0
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user