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.
32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
<div id="form-content">
|
|
<%= error_messages_for("wiki_page") %>
|
|
|
|
<%= simple_form_for(@wiki_page) do |f| %>
|
|
<% if @wiki_page.new_record? %>
|
|
<%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } } %>
|
|
<% else %>
|
|
<%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } }, hint: "Change to rename this wiki page. Move the tag and update any wikis linking to this page first." %>
|
|
<% end %>
|
|
|
|
<%= f.input :other_names, :as => :text, :label => "Other names (<a href='/wiki_pages/help:translated_tags'>view help</a>)".html_safe, :hint => "Names used for this tag on other sites such as Pixiv. Separate with spaces." %>
|
|
|
|
<%= dtext_field "wiki_page", "body" %>
|
|
|
|
<% if CurrentUser.is_builder? && @wiki_page.is_deleted? %>
|
|
<%= f.input :is_deleted, :label => "Deleted", :hint => "Uncheck to restore this wiki page" %>
|
|
<% end %>
|
|
|
|
<% if CurrentUser.is_builder? %>
|
|
<%= f.input :is_locked, :label => "Locked" %>
|
|
<% end %>
|
|
|
|
<% if @wiki_page.errors[:title].present? %>
|
|
<%= f.input :skip_secondary_validations, as: :boolean, label: "Force rename", hint: "Ignore the renaming requirements" %>
|
|
<% end %>
|
|
|
|
<%= f.button :submit, "Submit", :data => { :disable_with => "Submitting..." } %>
|
|
<%= dtext_preview_button "wiki_page", "body" %>
|
|
<% end %>
|
|
</div>
|
|
|