Sha256: 29cd4983d71b2e45882a155199ba138b75265c7ebaf7157bf771590d6f7343cd
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
module Motr module Forms autoload :Base, 'motr/forms/base' autoload :Helpers, 'motr/forms/helpers' autoload :Builder, 'motr/forms/builder' # The class to be applied to the wrapper that wraps the entire field mattr_accessor :error_class @@error_class = 'field_with_errors' # The class to be applied to the error message element mattr_accessor :message_error_class @@message_error_class = 'errors_for_field' # An ERB template to be used when rendering a field with errors mattr_accessor :error_template @@error_template = %{ <span class="<%= error_class %>"> <%= html_tag %> <span class="<%= message_error_class %>"><%= [messages].flatten.join(",") %></span> </span>} # Setup the default form builder mattr_accessor :default_builder @@default_builder = Motr::Forms::Builder # Stub out a new default_error_proc, but create the option to override it if necessary mattr_accessor :field_error_proc @@field_error_proc = lambda{ |html_tag, instance_tag| html_tag } protected ## # # Wrapper method to override the default field_error_proc # Field errors are displayed using the template defined by Motr::Forms.error_template # # @return [String] # def self.with_custom_error_proc(&block) default_proc = ::ActionView::Base.field_error_proc ::ActionView::Base.field_error_proc = Motr::Forms.field_error_proc yield ensure ::ActionView::Base.field_error_proc = default_proc end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motr-0.0.3 | lib/motr/forms.rb |
motr-0.0.2 | lib/motr/forms.rb |