Instead of having custom code check whether the artist name is already in use, just enable autocomplete on the artist name field. This is an easier and more robust way to indicate tag name conflicts.
18 lines
966 B
Plaintext
18 lines
966 B
Plaintext
<%= simple_form_for(@artist) do |f| %>
|
|
<% if @artist.new_record? %>
|
|
<%= f.input :name, input_html: { data: { autocomplete: "tag" } } %>
|
|
<% elsif CurrentUser.user.is_builder? %>
|
|
<%= f.input :name, input_html: { data: { autocomplete: "tag" } }, hint: "Change to rename this artist entry and its wiki page" %>
|
|
<% else %>
|
|
<p><%= @artist.name %></p>
|
|
<% end %>
|
|
|
|
<%= f.input :other_names_string, label: "Other names", as: :text, hint: '<b style="color: red;">NEW</b> Separate names with spaces, not commas. Use underscores for spaces inside names.'.html_safe %>
|
|
<%= f.input :group_name %>
|
|
<%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x5", :value => params.dig(:artist, :url_string) || @artist.urls.join("\n")}, :hint => "You can prefix a URL with - to mark it as dead." %>
|
|
|
|
<%= dtext_field "artist", "notes" %>
|
|
<%= f.button :submit, "Submit" %>
|
|
<%= dtext_preview_button "artist", "notes" %>
|
|
<% end %>
|