module Storefront class Form class Errors < Storefront::Form::Base def initialize(options = {}) super attributes.merge!(options[:error_html]) if options[:error_html] attributes.delete :error_html attributes.delete :error # error merge_class! @attributes, config.error_class # aria-invalid = true|grammar|spelling # aria-hidden attributes[:id] ||= attribute.to_id(:type => :error, :index => index, :parent_index => parent_index) if config.id_enabled_on.include?("error") @value = model.errors_for(attribute.name) end def render(&block) template.capture_haml do if value.present? template.haml_tag config.error_tag, attributes do template.haml_concat value.join("\n").html_safe.gsub(/\n$/) end elsif config.always_include_error_tag template.haml_tag config.error_tag, attributes end end end end end end