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 respond_to :json, :xml, :js, :html
def show 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) respond_with(@query)
end end
end end

View File

@@ -2,7 +2,7 @@
<div id="a-new"> <div id="a-new">
<h1>Alias &amp; Implication Import</h1> <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> <pre>
Use the following format: Use the following format:
@@ -13,28 +13,10 @@ create implication aaa -> bbb
mass update aaa -> bbb mass update aaa -> bbb
</pre> </pre>
<div class="input"> <%= f.input :text, label: "Script", as: :text, input_html: { size: "60x20" } %>
<label for="batch_text"> <%= f.input :forum_id, label: "Forum ID" %>
Script <%= f.input :rename_aliased_pages, label: "Renamed aliased wiki pages and artists", as: :boolean, checked: true %>
</label> <%= f.submit "Submit" %>
<%= 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 %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

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

View File

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