diff options
author | Go MAEDA <maeda@farend.jp> | 2020-12-06 02:55:10 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-12-06 02:55:10 +0000 |
commit | bb5acf4ec6ab4aeb98310ea71be1e913fb4cd786 (patch) | |
tree | 3f8cca89b94d6fb888d27dfb38518df618d12d41 /app/views | |
parent | 7b926116e20842568e0f1a6c3e67bb2f742cf6fa (diff) | |
download | redmine-bb5acf4ec6ab4aeb98310ea71be1e913fb4cd786.tar.gz redmine-bb5acf4ec6ab4aeb98310ea71be1e913fb4cd786.zip |
500 error when attempting to create custom field enumeration with empty name (#33930).
Patch by Kevin Fischer.
git-svn-id: http://svn.redmine.org/redmine/trunk@20583 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/custom_field_enumerations/create.js.erb | 7 | ||||
-rw-r--r-- | app/views/custom_field_enumerations/index.html.erb | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/views/custom_field_enumerations/create.js.erb b/app/views/custom_field_enumerations/create.js.erb index 9a9d40433..a81da16cb 100644 --- a/app/views/custom_field_enumerations/create.js.erb +++ b/app/views/custom_field_enumerations/create.js.erb @@ -1,2 +1,9 @@ +$('#errorExplanation').remove(); + +<% if @value.valid? %> $('#content').html('<%= escape_javascript(render(:template => 'custom_field_enumerations/index')) %>'); +<% else %> +$('form#add-element').prepend('<%= escape_javascript(error_messages_for(@value)) %>'); +<% end %> + $('#custom_field_enumeration_name').focus(); diff --git a/app/views/custom_field_enumerations/index.html.erb b/app/views/custom_field_enumerations/index.html.erb index 66a0977fd..83e9d59c9 100644 --- a/app/views/custom_field_enumerations/index.html.erb +++ b/app/views/custom_field_enumerations/index.html.erb @@ -26,9 +26,9 @@ <% end %> <% end %> -<p><%= l(:label_enumeration_new) %></p> +<%= form_tag custom_field_enumerations_path(@custom_field), :method => 'post', :remote => true, id: 'add-element' do %> + <p><%= l(:label_enumeration_new) %></p> -<%= form_tag custom_field_enumerations_path(@custom_field), :method => 'post', :remote => true do %> <p><%= text_field_tag 'custom_field_enumeration[name]', '', :size => 40 %> <%= submit_tag(l(:button_add)) %></p> <% end %> |