Files
danbooru/app/views/post_versions/_listing.html.erb
evazion 5c913d8ad1 table builder: fix various incorrect css classes.
Change calling convention to explicitly indicate whether the attributes
are for the <th> element or the <td> element. Fixes various cases where
the two were mixed up.

* Fix .col-expand classes not being set correctly on the /post_versions,
  /pool_versions, and /notes pages.

* Fix .updater and .updated-at classes not being set correctly on the
  /forum_topics page.

* Fix the name param being ignored (noticeable in the post count field
  on the /tags page).

* Don't pass empty string when column has no name.
2020-01-07 02:40:59 -06:00

44 lines
2.3 KiB
Plaintext

<div id="p-<%= post_versions_listing_type %>-listing">
<% if post_versions_listing_type == :revert %>
<%= PostPresenter.preview(@post_versions.first.post, show_deleted: true) %>
<% end %>
<%= table_for @post_versions, {id: "post-versions-table", class: "striped autofit"} do |t| %>
<% if CurrentUser.user.is_builder? %>
<% t.column tag.label(tag.input type: :checkbox, id: "post-version-select-all-checkbox", class: "post-version-select-checkbox"), th: { class: "post-version-select-column" }, td: { class: "post-version-select-column" } do |post_version| %>
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
<% end %>
<% end %>
<% if post_versions_listing_type == :standard %>
<% t.column "Post" do |post_version| %>
<%= PostPresenter.preview(post_version.post, show_deleted: true) %>
<% end %>
<% end %>
<% t.column "Version" do |post_version| %>
<%= link_to "#{post_version.post_id}.#{post_version.version}", post_versions_path(search: { post_id: post_version.post_id }, anchor: "post-version-#{post_version.id}") %>
<% end %>
<% t.column "Tags", td: {class: "col-expand"} do |post_version| %>
<%= post_version_diff(post_version) %>
<% end %>
<% t.column "Updated" 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) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip post_version.updater_ip_addr %>)
<% end %>
</div>
<% end %>
<% t.column do |post_version| %>
<% if post_version.can_undo?(CurrentUser.user) %>
<%= link_to "Undo", undo_post_version_path(post_version), method: :put, remote: true, class: "post-version-undo-link" %>
<% end %>
<% if post_versions_listing_type == :revert && post_version.can_revert_to?(CurrentUser.user) %>
| <%= link_to "Revert to", revert_post_path(post_version.post_id, version_id: post_version.id), method: :put, remote: true %>
<% end %>
<% end %>
<% end %>
</div>