Fix broken tag autocomplete on multiple pages.
Mark all tag <input>s with a `data-autocomplete` attribute, instead of
hardcoding a list of html IDs to autocomplete in javascript.
This way should be less error prone. It fixes autocomplete in several places:
* Autocomplete for the search box on /posts didn't work in the
responsive layout. This was because /posts has two search boxes that
both have the id `tags`: one in the normal sidebar, and one in the
responsive tag list. $("#tags") only initialized autocomplete on the
first one.
* Autocomplete didn't work on the aliases or implications pages. This
was due to selecting the wrong html ids.
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
|
||||
<div class="input" id="added-tags-input">
|
||||
<label>Added Tags</label>
|
||||
<%= text_field :constraints, :added_tags, :value => @constraints[:added_tags] %>
|
||||
<%= text_field :constraints, :added_tags, :value => @constraints[:added_tags], :data => { :autocomplete => "tag" } %>
|
||||
<p class="hint">You must specify a user to add tags</p>
|
||||
</div>
|
||||
|
||||
<div class="input" id="removed-tags-input">
|
||||
<label>Removed Tags</label>
|
||||
<%= text_field :constraints, :removed_tags, :value => @constraints[:removed_tags] %>
|
||||
<%= text_field :constraints, :removed_tags, :value => @constraints[:removed_tags], :data => { :autocomplete => "tag" } %>
|
||||
<p class="hint">You must specify a user to add tags</p>
|
||||
</div>
|
||||
|
||||
@@ -96,4 +96,4 @@
|
||||
});
|
||||
});
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div id="search">
|
||||
<%= form_tag(moderator_post_queue_path, :method => :get) do %>
|
||||
<%= text_field_tag "query", params[:query], :size => 40 %>
|
||||
<%= text_field_tag "query", params[:query], :size => 40, :data => { :autocomplete => "tag-query" } %>
|
||||
<%= select_tag "per_page", options_for_select(%w(25 50 100 200), cookies["mq_per_page"])%>
|
||||
<%= submit_tag "Search" %>
|
||||
<% end %>
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
<%= form_tag(moderator_tag_path, :method => :put, :class => "simple_form") do %>
|
||||
<div class="input">
|
||||
<label>Antecedent</label>
|
||||
<%= text_field :tag, :antecedent, :value => params[:antecedent] %>
|
||||
<%= 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] %>
|
||||
<%= text_field :tag, :consequent, :value => params[:consequent], :data => { :autocomplete => "tag-edit" } %>
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
|
||||
Reference in New Issue
Block a user