views: migrate related tags, mass edits to simple form.

This commit is contained in:
evazion
2019-09-10 21:51:14 -05:00
parent 896f144eb6
commit a5043245b6
4 changed files with 21 additions and 46 deletions

View File

@@ -2,7 +2,10 @@ class RelatedTagsController < ApplicationController
respond_to :json, :xml, :js, :html
def show
@query = RelatedTagQuery.new(query: params[:query], category: params[:category], user: CurrentUser.user)
query = params[:query] || search_params[:query]
category = params[:category] || search_params[:category]
@query = RelatedTagQuery.new(query: query, category: category, user: CurrentUser.user)
respond_with(@query)
end
end

View File

@@ -2,7 +2,7 @@
<div id="a-new">
<h1>Alias &amp; Implication Import</h1>
<%= form_tag(admin_alias_and_implication_import_path, :class => "simple_form") do %>
<%= simple_form_for(:batch, url: admin_alias_and_implication_import_path) do |f| %>
<pre>
Use the following format:
@@ -13,28 +13,10 @@ create implication aaa -> bbb
mass update aaa -> bbb
</pre>
<div class="input">
<label for="batch_text">
Script
</label>
<%= text_area "batch", "text", :size => "60x20" %>
</div>
<div class="input">
<label for="batch_forum_id">
Forum ID
</label>
<%= text_field "batch", "forum_id" %>
</div>
<div class="input">
<label for="batch_rename_aliased_pages">
<%= check_box "batch", "rename_aliased_pages", :checked => true %>
Rename aliased wiki pages and artists
</label>
</div>
<%= submit_tag %>
<%= f.input :text, label: "Script", as: :text, input_html: { size: "60x20" } %>
<%= f.input :forum_id, label: "Forum ID" %>
<%= f.input :rename_aliased_pages, label: "Renamed aliased wiki pages and artists", as: :boolean, checked: true %>
<%= f.submit "Submit" %>
<% end %>
</div>
</div>

View File

@@ -2,20 +2,10 @@
<div id="a-edit">
<h1>Mass Edit</h1>
<%= form_tag(moderator_tag_path, :method => :put, :class => "simple_form") do %>
<div class="input">
<label>Antecedent</label>
<%= text_field :tag, :antecedent, :value => params[:antecedent], :data => { :autocomplete => "tag-query" } %>
</div>
<div class="input">
<label>Consequent</label>
<%= text_field :tag, :consequent, :value => params[:consequent], :data => { :autocomplete => "tag-edit" } %>
</div>
<div class="input">
<%= submit_tag "Submit" %>
</div>
<%= simple_form_for(:tag, url: moderator_tag_path, method: :put) do |f| %>
<%= f.input :antecedent, input_html: { value: params[:antecedent], "data-autocomplete": "tag-query" } %>
<%= f.input :consequent, input_html: { value: params[:consequent], "data-autocomplete": "tag-edit" } %>
<%= f.submit "Submit" %>
<% end %>
</div>
</div>

View File

@@ -1,14 +1,14 @@
<div id="c-related-tags">
<div id="a-show">
<h1>Related tags</h1>
<section>
<%= form_tag(related_tag_path, :method => :get) do %>
<%= text_field_tag "query", params[:query], :data => { :autocomplete => "tag" } %>
<%= select_tag "category", options_for_select([""] + TagCategory.canonical_mapping.map{|x| [x.first, x.first.downcase]}, params[:category]) %>
<%= submit_tag "Show"%>
<% end %>
</section>
<% if params[:query].present? %>
<%= search_form_for(related_tag_path) do |f| %>
<%= f.input :query, label: "Tag", input_html: { value: params[:search][:query], "data-autocomplete": "tag" } %>
<%= f.input :category, collection: TagCategory.canonical_mapping, include_blank: true, selected: params[:search][:category] %>
<%= f.submit "Show" %>
<% end %>
<% if params.dig(:search, :query).present? %>
<section>
<table class="striped">
<thead>