Fix #4405: Post version table css doesn't keep ratio at smaller resolutions.

Bug: extremely long sources cause the Tags column to become extremely
wide. Caused by the source link not having the word-break property set.

Fix: use post_source_tag, which lets the `a[rel=external] { word-break: break-word; }`
rule take effect.

Example: https://danbooru.donmai.us/post_versions?search%5Bpost_id%5D=3809742
This commit is contained in:
evazion
2020-04-17 01:46:14 -05:00
parent 94180d77b4
commit ab4d596ac2
4 changed files with 7 additions and 7 deletions

View File

@@ -42,12 +42,12 @@ module PostsHelper
verifier.generate("#{value},#{session[:session_id]}")
end
def post_source_tag(post)
def post_source_tag(source, normalized_source = source)
# Only allow http:// and https:// links. Disallow javascript: links.
if post.source =~ %r!\Ahttps?://!i
external_link_to(post.normalized_source, strip: :subdomain) + " ".html_safe + link_to("»", post.source, rel: "external noreferrer nofollow")
if source =~ %r!\Ahttps?://!i
external_link_to(normalized_source, strip: :subdomain) + " ".html_safe + link_to("»", source, rel: "external noreferrer nofollow")
else
post.source
source
end
end

View File

@@ -40,7 +40,7 @@
<div class="row">
<span class="info">
<strong>Source</strong>
<%= post_source_tag(post) %>
<%= post_source_tag(post.source, post.normalized_source) %>
</span>
</div>

View File

@@ -24,7 +24,7 @@
</div>
<div><b>Tags:</b> <%= TagSetPresenter.new(post_version.tag_array).inline_tag_list_html %></div>
<div>
<%= post_version_field(post_version, :source) %>
<%= post_source_tag(post_version.source) %>
</div>
<% end %>
<% t.column "Edits", td: {class: "col-expand"}, width: "40%" do |post_version| %>

View File

@@ -22,7 +22,7 @@
(<span itemprop="width"><%= post.image_width %></span>x<span itemprop="height"><%= post.image_height %></span>)
<% end %>
</li>
<li id="post-info-source">Source: <%= post_source_tag(post) %></li>
<li id="post-info-source">Source: <%= post_source_tag(post.source, post.normalized_source) %></li>
<li id="post-info-rating">Rating: <%= post.pretty_rating %></li>
<li id="post-info-score">Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span>
<% if policy(PostVote).create? %>