From 2c46191f99c40df13ced59f4cf1f3fba1471bb25 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 14 Apr 2018 21:26:45 -0500 Subject: [PATCH] artists: fix edit form fields not being prefilled. * Fix the artist URLs field not being prefilled when clicking "Create new artist" in the "Fetch source data" box. * Fix the artist name field not being prefilled when clicking "Create new artist entry" on the /artists/show_or_new?name= page. --- app/views/artists/_form.html.erb | 2 +- app/views/artists/show_or_new.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index b286f8f6e..0a70e2acc 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -16,7 +16,7 @@ <%= f.input :other_names_comma, :hint => "Separate with commas", :as => :text, :label => "Other names" %> <%= f.input :group_name %> - <%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x5", :value => @artist.url_array.join("\n")} %> + <%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x5", :value => params.dig(:artist, :url_string) || @artist.url_array.join("\n")} %> <%= dtext_field "artist", "notes" %> <%= f.button :submit, "Submit" %> diff --git a/app/views/artists/show_or_new.html.erb b/app/views/artists/show_or_new.html.erb index 221f69869..05b1f0479 100644 --- a/app/views/artists/show_or_new.html.erb +++ b/app/views/artists/show_or_new.html.erb @@ -1,5 +1,5 @@ <%= render layout: "show" do %>
-

This artist entry does not exist. <%= link_to "Create new artist entry", new_artist_path(name: params[:name]) %>.

+

This artist entry does not exist. <%= link_to "Create new artist entry", new_artist_path(artist: { name: params[:name] }) %>.

<% end %>