diff --git a/app/helpers/spree/admin/base_helper_decorator.rb b/app/helpers/spree/admin/base_helper_decorator.rb index 5398cee35f..c1fd1ab223 100644 --- a/app/helpers/spree/admin/base_helper_decorator.rb +++ b/app/helpers/spree/admin/base_helper_decorator.rb @@ -23,6 +23,17 @@ module Spree link_to_with_icon('icon-trash', name, '#', html_options) + f.hidden_field(:_destroy) end + def link_to_remove_fields_without_url(name, f, options = {}) + name = '' if options[:no_text] + options[:class] = '' unless options[:class] + options[:class] += 'no-text with-tip' if options[:no_text] + + html_options = {class: "remove_fields #{options[:class]}", data: {action: 'remove'}, title: t(:remove)} + html_options.merge!(options[:html]) if options.key? :html + + link_to_with_icon('icon-trash', name, '#', html_options).gsub('href="#" ', '').html_safe + + f.hidden_field(:_destroy) + end end end end diff --git a/app/views/admin/producer_properties/_producer_property_fields.html.haml b/app/views/admin/producer_properties/_producer_property_fields.html.haml index 6fe0b1d7ad..65e6f1a15b 100644 --- a/app/views/admin/producer_properties/_producer_property_fields.html.haml +++ b/app/views/admin/producer_properties/_producer_property_fields.html.haml @@ -12,4 +12,4 @@ = f.text_field :value, :class => 'autocomplete' %td.actions - unless @enterprise.producer_properties.empty? - = link_to_remove_fields t(:remove), f, no_text: true, url: (f.object.persisted? && main_app.admin_enterprise_producer_property_path(@enterprise, f.object)), html: {"onclick" => "if(typeof(enterprise_form) != 'undefined') { angular.element(enterprise_form).scope().setFormDirty() }".html_safe} + = link_to_remove_fields_without_url t(:remove), f, no_text: true, html: {"onclick" => "if(typeof(enterprise_form) != 'undefined') { angular.element(enterprise_form).scope().setFormDirty() }".html_safe}