Rework post version view

- Added a changes column explicitly listing all of the changes
-- This makes it more in line with the other views now
This commit is contained in:
BrokenEagle
2020-02-08 08:57:26 +00:00
parent 7b1efd1204
commit 8ff00cfc7d
5 changed files with 18 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
<div id="p-<%= post_versions_listing_type %>-listing">
<% if post_versions_listing_type == :revert %>
<div id="p-<%= listing_type(:post_id) %>-listing">
<% if listing_type(:post_id) == :revert %>
<%= PostPresenter.preview(@post_versions.first.post, show_deleted: true) %>
<% end %>
@@ -9,17 +9,20 @@
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
<% end %>
<% end %>
<% if post_versions_listing_type == :standard %>
<% if listing_type(:post_id) == :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}") %>
<%= link_to "#{post_version.post_id}.#{post_version.version}", post_versions_path(search: { post_id: post_version.post_id }, anchor: "post-archive-#{post_version.id}") %>
<% end %>
<% t.column "Tags", td: {class: "col-expand"} do |post_version| %>
<%= post_version_diff(post_version) %>
<% end %>
<% t.column "Changes" do |post_version| %>
<%= status_diff_html(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 })) %>
@@ -31,7 +34,7 @@
<% 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) %>
<% if listing_type(:post_id) == :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 %>

View File

@@ -1,6 +1,6 @@
<div id="c-post-versions">
<div id="a-index">
<% if post_versions_listing_type == :revert && @post_versions.present? %>
<% if listing_type(:post_id) == :revert && @post_versions.present? %>
<h1>Tag History: <%= link_to "Post ##{params.dig(:search, :post_id)}", @post_versions[0].post %></h1>
<% else %>
<h1>Tag History</h1>