Files
danbooru/app/views/post_versions/_listing.html.erb
evazion ab4d596ac2 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
2020-04-17 01:46:14 -05:00

54 lines
2.8 KiB
Plaintext

<div id="p-<%= listing_type(:post_id) %>-listing">
<% if listing_type(:post_id) == :revert %>
<%= PostPresenter.preview(@post_versions.first.post, show_deleted: true) %>
<% end %>
<%= table_for @post_versions, id: "post-versions-table", class: "striped autofit", width: "100%" do |t| %>
<% if policy(@post_versions).can_mass_undo? %>
<% t.column tag.label(tag.input type: :checkbox, id: "post-version-select-all-checkbox", class: "post-version-select-checkbox"), column: "post-version-select", width: "1%" do |post_version| %>
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless policy(post_version).undo? %>>
<% end %>
<% end %>
<% if listing_type(:post_id) == :standard %>
<% t.column "Post", width: "1%" do |post_version| %>
<%= PostPresenter.preview(post_version.post, show_deleted: true) %>
<% end %>
<% end %>
<% t.column "Version", width: "1%" do |post_version| %>
<%= link_to "#{post_version.post_id}.#{post_version.version}", post_versions_path(search: { post_id: post_version.post_id }, type: params[:type], anchor: "post-version-#{post_version.id}") %>
<% end %>
<% t.column "Tags", td: {class: "col-expand"}, width: "40%" do |post_version| %>
<div>
<%= post_version_field(post_version, :rating) %>
<%= post_version_field(post_version, :parent_id) %>
</div>
<div><b>Tags:</b> <%= TagSetPresenter.new(post_version.tag_array).inline_tag_list_html %></div>
<div>
<%= post_source_tag(post_version.source) %>
</div>
<% end %>
<% t.column "Edits", td: {class: "col-expand"}, width: "40%" do |post_version| %>
<%= post_version_diff(post_version, params[:type]) %>
<% end %>
<% t.column "Changes", width: "5%" do |post_version| %>
<%= status_diff_html(post_version, params[:type]) %>
<% end %>
<% t.column "Updated", width: "5%" do |post_version| %>
<%= link_to_user post_version.updater %>
<%= link_to "»", post_versions_path(search: params[:search].merge({ updater_name: post_version.updater&.name })) %>
<div>
<%= compact_time(post_version.updated_at) %>
</div>
<% end %>
<% t.column column: "action", width: "5%" do |post_version| %>
<% if policy(post_version).undo? %>
<%= link_to "Undo", undo_post_version_path(post_version), method: :put, remote: true, class: "post-version-undo-link" %>
<% end %>
<% if listing_type(:post_id) == :revert && policy(post_version.post).revert? %>
| <%= link_to "Revert to", revert_post_path(post_version.post_id, version_id: post_version.id), method: :put, remote: true %>
<% end %>
<% end %>
<% end %>
</div>