posts: always show "resized to X%" notice on mobile.
Always show the "Resized to X% of original" notice when viewing a sample image on mobile.
This commit is contained in:
@@ -430,12 +430,19 @@ div#c-posts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body[data-post-current-image-size="large"] .image-view-large-link,
|
body[data-post-current-image-size="large"] #post-options .image-view-large-link,
|
||||||
body[data-post-current-image-size="original"] .image-view-original-link,
|
body[data-post-current-image-size="original"] #post-options .image-view-original-link,
|
||||||
body[data-post-current-image-size="original"] #image-resize-notice {
|
body[data-post-current-image-size="original"] #image-resize-notice {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Always show the "Resized to X% of original" notice on mobile when it exists. */
|
||||||
|
#image-resize-notice {
|
||||||
|
@media screen and (max-width: 660px) {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body.mode-translation .note-container {
|
body.mode-translation .note-container {
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resize_percentage
|
def resize_percentage
|
||||||
|
return 100 if image_width.to_i == 0
|
||||||
100 * large_image_width.to_f / image_width.to_f
|
100 * large_image_width.to_f / image_width.to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if policy(post).visible? && post.has_large? && !post.is_ugoira? %>
|
<% if policy(post).visible? && post.has_large? && !post.is_ugoira? && post.resize_percentage.floor < 100 %>
|
||||||
<div class="notice notice-small post-notice post-notice-resized" id="image-resize-notice">
|
<div class="notice notice-small post-notice post-notice-resized" id="image-resize-notice">
|
||||||
Resized to <%= number_to_percentage post.resize_percentage.floor, precision: 0 %> of original (<%= link_to "view original", post.tagged_file_url, class: "image-view-original-link" %>)
|
Resized to <%= number_to_percentage post.resize_percentage.floor, precision: 0 %> of original (<%= link_to "view original", post.tagged_file_url, class: "image-view-original-link" %>)
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user