diff --git a/app/helpers/artist_commentary_versions_helper.rb b/app/helpers/artist_commentary_versions_helper.rb
new file mode 100644
index 000000000..679cb991c
--- /dev/null
+++ b/app/helpers/artist_commentary_versions_helper.rb
@@ -0,0 +1,6 @@
+module ArtistCommentaryVersionsHelper
+ def artist_commentary_versions_listing_type
+ params.dig(:search, :post_id).present? ? :revert : :standard
+ end
+
+end
diff --git a/app/helpers/note_versions_helper.rb b/app/helpers/note_versions_helper.rb
index e007faba1..0c3722c96 100644
--- a/app/helpers/note_versions_helper.rb
+++ b/app/helpers/note_versions_helper.rb
@@ -1,4 +1,8 @@
module NoteVersionsHelper
+ def note_versions_listing_type
+ (params.dig(:search, :post_id).present? || params.dig(:search, :note_id).present?) && CurrentUser.is_member? ? :revert : :standard
+ end
+
def note_version_body_diff_info(note_version)
previous = note_version.previous
if previous.nil?
diff --git a/app/helpers/pool_versions_helper.rb b/app/helpers/pool_versions_helper.rb
new file mode 100644
index 000000000..c52d6f44c
--- /dev/null
+++ b/app/helpers/pool_versions_helper.rb
@@ -0,0 +1,6 @@
+module PoolVersionsHelper
+ def pool_versions_listing_type
+ params.dig(:search, :pool_id).present? ? :revert : :standard
+ end
+
+end
diff --git a/app/helpers/post_versions_helper.rb b/app/helpers/post_versions_helper.rb
index 685ca16aa..3e354f7c1 100644
--- a/app/helpers/post_versions_helper.rb
+++ b/app/helpers/post_versions_helper.rb
@@ -1,5 +1,5 @@
module PostVersionsHelper
- def post_version_listing
+ def post_versions_listing_type
params.dig(:search, :post_id).present? ? :revert : :standard
end
diff --git a/app/views/artist_commentary_versions/_revert_listing.html.erb b/app/views/artist_commentary_versions/_revert_listing.html.erb
deleted file mode 100644
index ba4d80252..000000000
--- a/app/views/artist_commentary_versions/_revert_listing.html.erb
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- <%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
- <% t.column "Post", {width: "5%"} do |commentary_version| %>
- <%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
- <% end %>
- <% t.column "Original" do |commentary_version| %>
- <%= format_commentary_title(commentary_version.original_title) %>
- <%= format_commentary_description(commentary_version.original_description) %>
- <% end %>
- <% t.column "Translated" do |commentary_version| %>
- <%= format_commentary_title(commentary_version.translated_title) %>
- <%= format_commentary_description(commentary_version.translated_description) %>
- <% end %>
- <% if CurrentUser.is_moderator? %>
- <% t.column "IP Address", {width: "10%"} do |commentary_version| %>
- <%= link_to_ip commentary_version.updater_ip_addr %>
- <% end %>
- <% end %>
- <% t.column "Edited by", {width: "10%"} do |commentary_version| %>
- <%= link_to_user commentary_version.updater %>
- <% end %>
- <% t.column "Date", {width: "10%"} do |commentary_version| %>
- <%= compact_time commentary_version.updated_at %>
- <% end %>
- <% if CurrentUser.is_member? %>
- <% t.column "", {width: "7%"} do |commentary_version| %>
- <%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
- <% end %>
- <% end %>
- <% end %>
-
-
diff --git a/app/views/artist_commentary_versions/_standard_listing.html.erb b/app/views/artist_commentary_versions/_standard_listing.html.erb
index bf305942b..bf66b7786 100644
--- a/app/views/artist_commentary_versions/_standard_listing.html.erb
+++ b/app/views/artist_commentary_versions/_standard_listing.html.erb
@@ -1,11 +1,17 @@
-
+
diff --git a/app/views/artist_commentary_versions/index.html.erb b/app/views/artist_commentary_versions/index.html.erb
index 41c24cea5..25a7f65f8 100644
--- a/app/views/artist_commentary_versions/index.html.erb
+++ b/app/views/artist_commentary_versions/index.html.erb
@@ -4,11 +4,7 @@
<%= render "posts/partials/common/inline_blacklist" %>
- <% if params.dig(:search, :post_id).present? %>
- <%= render "revert_listing" %>
- <% else %>
- <%= render "standard_listing" %>
- <% end %>
+ <%= render "standard_listing" %>
<%= numbered_paginator(@commentary_versions) %>
diff --git a/app/views/note_versions/_revert_listing.html.erb b/app/views/note_versions/_revert_listing.html.erb
deleted file mode 100644
index 2be50b472..000000000
--- a/app/views/note_versions/_revert_listing.html.erb
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
- <%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
- <% t.column %>
- <% t.column "Post", {width: "5%"} do |note_version| %>
- <%= link_to note_version.post_id, post_path(note_version.post_id) %>
- <% if params.dig(:search, :note_id).present? %>
- <%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %>
- <% end %>
- <% end %>
- <% t.column "Note", {width: "5%"} do |note_version| %>
- <%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %>
- <% if params.dig(:search, :post_id).present? %>
- <%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %>
- <% end %>
- <% end %>
- <% t.column "Body", nil, {class: "col-expand"} do |note_version| %>
- <%= h(note_version.body) %>
- <% unless note_version.is_active? %>
- (deleted)
- <% end %>
- <%= note_version_body_diff_info(note_version) %>
- <% end %>
- <% t.column "Position", {width: "5%"} do |note_version| %>
- <%= note_version_position_diff(note_version) %>
- <% end %>
- <% if CurrentUser.is_moderator? %>
- <% t.column "IP Address", {width: "10%"} do |note_version| %>
- <%= link_to_ip note_version.updater_ip_addr %>
- <% end %>
- <% end %>
- <% t.column "Edited By", {width: "10%"} do |note_version| %>
- <%= link_to_user note_version.updater %>
- <% end %>
- <% t.column "Date", {width: "10%"} do |note_version| %>
- <%= compact_time note_version.updated_at %>
- <% end %>
- <% if CurrentUser.is_member? %>
- <% t.column "", {width: "7%"} do |note_version| %>
- <%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
- <% end %>
- <% end %>
- <% end %>
-
-
diff --git a/app/views/note_versions/_standard_listing.html.erb b/app/views/note_versions/_standard_listing.html.erb
index 13e39c55d..3dcc10f2b 100644
--- a/app/views/note_versions/_standard_listing.html.erb
+++ b/app/views/note_versions/_standard_listing.html.erb
@@ -1,4 +1,4 @@
-
+
<%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column %>
@@ -35,6 +35,11 @@
<% t.column "Date", {width: "10%"} do |note_version| %>
<%= compact_time note_version.updated_at %>
<% end %>
+ <% if note_versions_listing_type == :revert %>
+ <% t.column "", {width: "7%"} do |note_version| %>
+ <%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
+ <% end %>
+ <% end %>
<% end %>
diff --git a/app/views/note_versions/index.html.erb b/app/views/note_versions/index.html.erb
index 008e11cb4..fe51998a0 100644
--- a/app/views/note_versions/index.html.erb
+++ b/app/views/note_versions/index.html.erb
@@ -2,11 +2,7 @@
Note Changes
- <% if params.dig(:search, :post_id).present? || params.dig(:search, :note_id).present? %>
- <%= render "revert_listing" %>
- <% else %>
- <%= render "standard_listing" %>
- <% end %>
+ <%= render "standard_listing" %>
<%= numbered_paginator(@note_versions) %>
diff --git a/app/views/pool_versions/_revert_listing.html.erb b/app/views/pool_versions/_revert_listing.html.erb
deleted file mode 100644
index 13d8966c9..000000000
--- a/app/views/pool_versions/_revert_listing.html.erb
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
- <%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
- <% t.column "Pool" do |pool_version| %>
- <%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), class: "pool-category-#{pool_version.pool.category}" %>
- <%= link_to "»", pool_versions_path(search: { pool_id: pool_version.pool_id }), class: "pool-category-#{pool_version.pool.category}" %>
- <% end %>
- <% t.column "Changes", class: "col-expand" do |pool_version| %>
- <%= render "pool_versions/diff", diff: pool_version.build_diff %>
- <% end %>
- <% t.column "Post Count" do |pool_version| %>
- <%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %>
- <% end %>
- <% t.column "Desc Chg" do |pool_version| %>
- <%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %>
- <% end %>
- <% t.column "Updater" do |pool_version| %>
- <% if pool_version.updater %>
- <%= link_to_user pool_version.updater %>
- <%= link_to "»", pool_versions_path(search: { updater_id: pool_version.updater_id }) %>
- <% end %>
- <% end %>
- <% if CurrentUser.is_moderator? %>
- <% t.column "IP Address" do |pool_version| %>
- <%= link_to_ip pool_version.updater_ip_addr %>
- <% end %>
- <% end %>
- <% t.column "Date" do |pool_version| %>
- <%= compact_time pool_version.updated_at %>
- <% end %>
- <% if CurrentUser.is_member? %>
- <% t.column "" do |pool_version| %>
- <%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %>
- <% end %>
- <% end %>
- <% end %>
-
-
diff --git a/app/views/pool_versions/_standard_listing.html.erb b/app/views/pool_versions/_standard_listing.html.erb
index c34ddc91f..5f5a7e60d 100644
--- a/app/views/pool_versions/_standard_listing.html.erb
+++ b/app/views/pool_versions/_standard_listing.html.erb
@@ -1,4 +1,4 @@
-
+
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Pool" do |pool_version| %>
@@ -28,6 +28,11 @@
<% t.column "Date" do |pool_version| %>
<%= compact_time pool_version.updated_at %>
<% end %>
+ <% if pool_versions_listing_type == :revert %>
+ <% t.column "" do |pool_version| %>
+ <%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %>
+ <% end %>
+ <% end %>
<% end %>
diff --git a/app/views/pool_versions/index.html.erb b/app/views/pool_versions/index.html.erb
index f0d30f871..541540ec2 100644
--- a/app/views/pool_versions/index.html.erb
+++ b/app/views/pool_versions/index.html.erb
@@ -2,11 +2,7 @@
Pool History
- <% if params.dig(:search, :pool_id).present? %>
- <%= render "revert_listing" %>
- <% else %>
- <%= render "standard_listing" %>
- <% end %>
+ <%= render "standard_listing" %>
<%= numbered_paginator(@pool_versions) %>
diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_listing.html.erb
index 4eb96937f..a0538e320 100644
--- a/app/views/post_versions/_listing.html.erb
+++ b/app/views/post_versions/_listing.html.erb
@@ -1,5 +1,5 @@
-
- <% if post_version_listing == :revert %>
+
+ <% if post_versions_listing_type == :revert %>
<%= PostPresenter.preview(@post_versions.first.post, show_deleted: true) %>
<% end %>
@@ -9,7 +9,7 @@
>
<% end %>
<% end %>
- <% if post_version_listing == :standard %>
+ <% if post_versions_listing_type == :standard %>
<% t.column "Post" do |post_version| %>
<%= PostPresenter.preview(post_version.post, show_deleted: true) %>
<% end %>
@@ -34,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_version_listing == :revert && post_version.can_revert_to?(CurrentUser.user) %>
+ <% 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 %>
diff --git a/app/views/post_versions/index.html.erb b/app/views/post_versions/index.html.erb
index 4eef00c02..6fc04c52b 100644
--- a/app/views/post_versions/index.html.erb
+++ b/app/views/post_versions/index.html.erb
@@ -1,6 +1,6 @@
- <% if post_version_listing == :revert && @post_versions.present? %>
+ <% if post_versions_listing_type == :revert && @post_versions.present? %>
Tag History: <%= link_to "Post ##{params.dig(:search, :post_id)}", @post_versions[0].post %>
<% else %>
Tag History