diff --git a/app/javascript/src/styles/specific/post_versions.scss b/app/javascript/src/styles/specific/post_versions.scss index b832e3622..a52116b41 100644 --- a/app/javascript/src/styles/specific/post_versions.scss +++ b/app/javascript/src/styles/specific/post_versions.scss @@ -6,4 +6,13 @@ body.c-post-versions.a-index { .post-version-select-column { min-width: 2em; } + + .advanced-search-link { + margin: 0 1em; + } + + #p-revert-listing { + display: flex; + table#post-versions-table { flex: 1; } + } } diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 121290196..170cd7c44 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -183,7 +183,7 @@ class ApplicationRecord < ActiveRecord::Base relation = relation.where_array_includes_any(name, items) elsif params[:"#{name}_include_all"] - items = params[:"#{name}_include_any"].to_s.scan(/[^[:space:]]+/) + items = params[:"#{name}_include_all"].to_s.scan(/[^[:space:]]+/) items = items.map(&:to_i) if type == :integer relation = relation.where_array_includes_all(name, items) diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_listing.html.erb index ee2a86dbd..f87330f56 100644 --- a/app/views/post_versions/_listing.html.erb +++ b/app/views/post_versions/_listing.html.erb @@ -1,5 +1,9 @@
| <%= post_version_diff(post_version) %> |
<%= link_to_user post_version.updater %>
- <%= link_to "»", post_versions_path(search: { updater_name: post_version.updater&.name }) %>
+ <%= link_to "»", post_versions_path(search: params[:search].merge({ updater_name: post_version.updater&.name })) %>
<%= compact_time(post_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
diff --git a/app/views/post_versions/_secondary_links.html.erb b/app/views/post_versions/_secondary_links.html.erb
index 8e5166e10..937e83533 100644
--- a/app/views/post_versions/_secondary_links.html.erb
+++ b/app/views/post_versions/_secondary_links.html.erb
@@ -1,10 +1,7 @@
<% content_for(:secondary_links) do %>
- <%= quick_search_form_for(:changed_tags, post_versions_path, "versions", autocomplete: "tag-query") %>
- <%= subnav_link_to "Listing", posts_path %>
- <%= subnav_link_to "Upload", new_upload_path %>
+ <%= quick_search_form_for(:changed_tags, post_versions_path, "by tags", autocomplete: "tag-query") %>
+ <%= subnav_link_to "Listing", post_versions_path %>
<%= subnav_link_to "Search", search_post_versions_path %>
- <%= subnav_link_to "Changes", post_versions_path %>
- <%= subnav_link_to "Help", wiki_pages_path(:title => "help:posts") %>
<% if params[:action] == "index" %>
| <%= subnav_link_to "Undo selected", "" %>
<% end %>
diff --git a/app/views/post_versions/index.html.erb b/app/views/post_versions/index.html.erb
index 2526210e3..4eef00c02 100644
--- a/app/views/post_versions/index.html.erb
+++ b/app/views/post_versions/index.html.erb
@@ -1,12 +1,21 @@
- <% if post_version_listing == :revert %>
+ <% if post_version_listing == :revert && @post_versions.present? %>
Tag History: <%= link_to "Post ##{params.dig(:search, :post_id)}", @post_versions[0].post %>- <%= PostPresenter.preview(@post_versions[0].post, show_deleted: true) %> <% else %>Tag History<% end %> + <%= search_form_for(post_versions_path, classes: "inline-form") do |f| %> + <%= f.input :post_id, label: "Post", input_html: { value: params.dig(:search, :post_id) } %> + <%= f.input :updater_name, label: "Updater", input_html: { "data-autocomplete": "user", value: params.dig(:search, :updater_name) } %> + <%= f.input :added_tags_include_all, label: "Added Tags", input_html: { "data-autocomplete": "tag-query", value: params.dig(:search, :added_tags_include_all) } %> + <%= f.input :removed_tags_include_all, label: "Removed Tags", input_html: { "data-autocomplete": "tag-query", value: params.dig(:search, :removed_tags_include_all) } %> + <%= f.input :changed_tags, label: "Changed Tags", input_html: { "data-autocomplete": "tag-query", value: params.dig(:search, :changed_tags) } %> + <%= f.submit "Search" %> + <%= link_to "Advanced", search_post_versions_path, class: "advanced-search-link" %> + <% end %> + <%= render "posts/partials/common/inline_blacklist" %>Recent updates may not have been processed yet. The most recently processed version was <%= time_ago_in_words_tagged(PostArchive.maximum(:updated_at)) %>. diff --git a/app/views/post_versions/search.html.erb b/app/views/post_versions/search.html.erb index 3a9b76154..0413edc9b 100644 --- a/app/views/post_versions/search.html.erb +++ b/app/views/post_versions/search.html.erb @@ -5,9 +5,9 @@ <%= search_form_for(post_versions_path) do |f| %> <%= f.input :updated_at, label: "Date" %> <%= f.input :updater_name, label: "Updater", input_html: { "data-autocomplete": "user" } %> - <%= f.input :changed_tags_include_all, label: "Changed tags", input_html: { "data-autocomplete": "tag-query" } %> <%= f.input :added_tags_include_all, label: "Added tags", input_html: { "data-autocomplete": "tag-query" } %> <%= f.input :removed_tags_include_all, label: "Removed tags", input_html: { "data-autocomplete": "tag-query" } %> + <%= f.input :changed_tags, label: "Changed tags", input_html: { "data-autocomplete": "tag-query" } %> <%= f.input :post_id %> <%= f.input :parent_id %> <%= f.input :rating %> |