diff --git a/app/views/ingredients/_filters.html.erb b/app/views/ingredients/_filters.html.erb index ede4210..bcc4d21 100644 --- a/app/views/ingredients/_filters.html.erb +++ b/app/views/ingredients/_filters.html.erb @@ -3,33 +3,35 @@
<%= error_messages_for @formula_q %> - <%= form_tag url, id: 'filters_form', method: :get, remote: true do %> + <%= form_tag url, id: 'filters-form', name: 'filters-form', + method: :get, remote: true do %> +
<%= text_field_tag 'filters[name]', session[:i_filters][:name], placeholder: 'name', - onblur: '$("#filters_form").submit(); return false;' %> + onblur: '$("#filters-form").submit(); return false;' %> <%= select_tag 'filters[visibility]', visibility_options(session[:i_filters][:visibility]), prompt: t('.visibility_prompt'), - onchange: '$("#filters_form").submit(); return false;' %> + onchange: '$("#filters-form").submit();' %> <%= text_field_tag 'filters[nutrients]', session[:i_filters][:nutrients], placeholder: 'conditional expression including nutrients', size: 40, style: 'box-sizing:border-box; width:100%;', - onblur: '$("#filters_form").submit(); return false;' %> + onblur: '$("#filters-form").submit(); return false;' %> <%= link_to l(:button_apply), '#', class: "icon icon-checked", - onclick: '$("#filters_form").submit(); return false;' %> + onclick: '$("#filters-form").submit(); return false;' %> <%= link_to l(:button_clear), '#', class: "icon icon-reload", - onclick: '$("#filters_form input, #filters_form select").val(""); - $("#filters_form").submit(); return false;' %> + onclick: '$("#filters-form input, #filters-form select").val(""); + $("#filters-form").submit(); return false;' %>
diff --git a/app/views/ingredients/_form.html.erb b/app/views/ingredients/_form.html.erb index 8b24771..1863df9 100644 --- a/app/views/ingredients/_form.html.erb +++ b/app/views/ingredients/_form.html.erb @@ -2,8 +2,9 @@

<%= t ".heading_new_ingredient" %>

<%= labelled_form_for @ingredient, - url: project_ingredients_path(@project), - html: {id: 'ingredient-form'} do |f| %> + url: project_ingredients_path(@project), + html: {id: 'ingredient-add-form', name: 'ingredient-add-form'} do |f| %> + <%= error_messages_for @ingredient %>
diff --git a/app/views/ingredients/_import.html.erb b/app/views/ingredients/_import.html.erb index fa8d6fc..99cdd25 100644 --- a/app/views/ingredients/_import.html.erb +++ b/app/views/ingredients/_import.html.erb @@ -2,8 +2,8 @@

<%= t ".heading_import_ingredients" %>

<%= form_tag import_project_ingredients_path(@project), - multipart: true, - id: 'import-form' do %> + id: 'import-form', name: 'import-form', multipart: true do %> +

diff --git a/app/views/ingredients/_options.html.erb b/app/views/ingredients/_options.html.erb index f8ec48a..65a0e62 100644 --- a/app/views/ingredients/_options.html.erb +++ b/app/views/ingredients/_options.html.erb @@ -2,7 +2,9 @@ <%= l(:label_options) %>

<%= form_tag toggle_nutrient_column_project_ingredients_path(@project), - id: 'add_nutrient_column', method: :post, remote: true do %> + id: 'nutrient-column-add-form', name: 'nutrient-column-add-form', + method: :post, remote: true do %> + diff --git a/app/views/measurements/_form.html.erb b/app/views/measurements/_form.html.erb index e8fded3..81b6fc2 100644 --- a/app/views/measurements/_form.html.erb +++ b/app/views/measurements/_form.html.erb @@ -2,8 +2,9 @@

<%= t ".heading_new_measurement" %>

<%= labelled_form_for @measurement, - url: project_measurements_path(@project), - html: {id: 'measurement-form'} do |f| %> + url: project_measurements_path(@project), + html: {id: 'measurement-add-form', name: 'measurement-add-form'} do |f| %> + <%= error_messages_for @measurement %>
diff --git a/app/views/quantities/_filters.html.erb b/app/views/quantities/_filters.html.erb index baf39c5..b07fe12 100644 --- a/app/views/quantities/_filters.html.erb +++ b/app/views/quantities/_filters.html.erb @@ -1,7 +1,9 @@
<%= l(:label_filter_plural) %>
- <%= form_tag url, id: 'filters_form', method: :get, remote: true do %> + <%= form_tag url, id: 'filters-form', name: 'filters-form', + method: :get, remote: true do %> +
@@ -9,16 +11,16 @@ <%= select_tag 'filters[domain]', domain_options_tag(session[:q_filters][:domain]), prompt: t('.domain_prompt'), - onchange: '$("#filters_form").submit(); return false;' %> + onchange: '$("#filters-form").submit();' %> <%= link_to l(:button_apply), '#', class: "icon icon-checked", - onclick: '$("#filters_form").submit(); return false;' %> + onclick: '$("#filters-form").submit(); return false;' %> <%= link_to l(:button_clear), '#', class: "icon icon-reload", - onclick: '$("#filters_form input, #filters_form select").val(""); - $("#filters_form").submit(); return false;' %> + onclick: '$("#filters-form input, #filters-form select").val(""); + $("#filters-form").submit(); return false;' %>
diff --git a/app/views/quantities/_form.html.erb b/app/views/quantities/_form.html.erb index 541925a..1c8ac3b 100644 --- a/app/views/quantities/_form.html.erb +++ b/app/views/quantities/_form.html.erb @@ -1,11 +1,12 @@ <%= error_messages_for @quantity %>
-

<%= f.select :domain, domain_options, {required: true}, data: { - remote: true, - url: parents_project_quantities_path(@project), - params: "form=#{f.options[:html][:id]}" - } %>

+

<%= f.select :domain, domain_options, {required: true}, + {autocomplete: 'off', + data: {remote: true, + url: parents_project_quantities_path(@project), + params: "form=#{f.options[:html][:id]}"}} + %>

<%= f.select :parent_id, parent_options(@quantity.domain), {required: true, label: :field_parent_quantity, include_blank: t('.null_parent')} %>

<%= f.text_field :name, size: 25, required: true %>

diff --git a/app/views/quantities/_index.html.erb b/app/views/quantities/_index.html.erb index 9e94879..5920abc 100644 --- a/app/views/quantities/_index.html.erb +++ b/app/views/quantities/_index.html.erb @@ -65,8 +65,10 @@
- <%= labelled_form_for @quantity, url: quantity_path(@quantity), method: :patch, - remote: true, html: {id: 'quantity-edit-form'} do |f| %> + <%= labelled_form_for @quantity, + url: quantity_path(@quantity), + method: :patch, remote: true, + html: {id: 'quantity-edit-form', name: 'quantity-edit-form'} do |f| %> <%= render partial: 'quantities/form', locals: {f: f} %> <%= submit_tag l(:button_save) %> diff --git a/app/views/quantities/index.html.erb b/app/views/quantities/index.html.erb index 20d3803..a8c1d06 100644 --- a/app/views/quantities/index.html.erb +++ b/app/views/quantities/index.html.erb @@ -13,8 +13,9 @@

<%= t ".heading_new_quantity" %>

<%= labelled_form_for @quantity, - url: project_quantities_path(@project), - html: {id: 'quantity-add-form'} do |f| %> + url: project_quantities_path(@project), + html: {id: 'quantity-add-form', name: 'quantity-add-form'} do |f| %> + <%= render partial: 'quantities/form', locals: {f: f} %> <%= submit_tag l(:button_create) %> <%= link_to l(:button_cancel), "#", onclick: '$("#add-quantity").hide(); return false;' %> diff --git a/app/views/sources/index.html.erb b/app/views/sources/index.html.erb index 11b8d53..261e500 100644 --- a/app/views/sources/index.html.erb +++ b/app/views/sources/index.html.erb @@ -13,8 +13,9 @@

<%= t ".heading_new_source" %>

<%= labelled_form_for @source, - url: project_sources_path(@project), - html: {id: 'source-form'} do |f| %> + url: project_sources_path(@project), + html: {id: 'source-add-form', name: 'source-add-form'} do |f| %> + <%= render partial: 'sources/form', locals: {f: f} %> <%= submit_tag l(:button_create) %> <%= link_to l(:button_cancel), "#", onclick: '$("#add-source").hide(); return false;' %> diff --git a/app/views/units/index.html.erb b/app/views/units/index.html.erb index d8b957e..c125803 100644 --- a/app/views/units/index.html.erb +++ b/app/views/units/index.html.erb @@ -13,8 +13,9 @@

<%= t ".heading_new_unit" %>

<%= labelled_form_for @unit, - url: project_units_path(@project), - html: {id: 'unit-form'} do |f| %> + url: project_units_path(@project), + html: {id: 'unit-add-form', name: 'unit-add-form'} do |f| %> + <%= render partial: 'units/form', locals: {f: f} %> <%= submit_tag l(:button_create) %> <%= link_to l(:button_cancel), "#", onclick: '$("#add-unit").hide(); return false;' %>