mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge base_helper with decorator
This commit is contained in:
@@ -71,6 +71,8 @@ module Spree
|
||||
password_field_tag(name, value, preference_field_options(options))
|
||||
when :text
|
||||
text_area_tag(name, value, preference_field_options(options))
|
||||
when :file
|
||||
file_field_tag name, preference_field_options(options)
|
||||
else
|
||||
text_field_tag(name, value, preference_field_options(options))
|
||||
end
|
||||
@@ -137,12 +139,16 @@ module Spree
|
||||
end
|
||||
|
||||
# renders hidden field and link to remove record using nested_attributes
|
||||
# add support for options[:html], allowing additional HTML attributes
|
||||
def link_to_remove_fields(name, f, options = {})
|
||||
name = '' if options[:no_text]
|
||||
options[:class] = '' unless options[:class]
|
||||
options[:class] += 'no-text with-tip' if options[:no_text]
|
||||
url = f.object.persisted? ? [:admin, f.object] : '#'
|
||||
link_to_with_icon('icon-trash', name, url, :class => "spree_remove_fields #{options[:class]}", :data => {:action => 'remove'}, :title => Spree.t(:remove)) + f.hidden_field(:_destroy)
|
||||
|
||||
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) + f.hidden_field(:_destroy)
|
||||
end
|
||||
|
||||
def spree_dom_id(record)
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
require 'spree/admin/base_helper'
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
module BaseHelper
|
||||
def preference_field_tag_with_files(name, value, options)
|
||||
if options[:type] == :file
|
||||
file_field_tag name, preference_field_options(options)
|
||||
else
|
||||
preference_field_tag_without_files name, value, options
|
||||
end
|
||||
end
|
||||
alias_method_chain :preference_field_tag, :files
|
||||
|
||||
# Add support for options[:html], allowing additional HTML attributes
|
||||
def link_to_remove_fields(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) + f.hidden_field(:_destroy)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user