mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix removal of producer properties - remove href attr so Spree doesn't attempt an XHR
This commit is contained in:
committed by
Rob Harrington
parent
bfaaf16030
commit
ac8cfe24e6
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user