Sha256: 8fa4fb0d0e8c9af4a879ec933fe3bffe5f2e3da0dfb08596740e27927aba667c

Contents?: true

Size: 1.62 KB

Versions: 23

Compression:

Stored size: 1.62 KB

Contents

module FlexaFormtasticBootstrap
  module Inputs
    module Base
      module Errors

        include Formtastic::Inputs::Base::Errors

        def error_html(inline_or_block = :inline)
          errors? ? send(:"error_#{builder.inline_errors}_html", inline_or_block) : ""
        end

        def error_sentence_html(inline_or_block)
          error_class = if inline_or_block == :inline
            options[:error_class] || builder.default_inline_error_class
          else
            options[:error_class] || builder.default_block_error_class
          end
          template.content_tag(:span, Formtastic::Util.html_safe(errors.to_sentence.html_safe), :class => error_class)
        end

        def error_list_html(ignore)
          super()
          # error_class = options[:error_class] || builder.default_error_list_class
          # list_elements = []
          # errors.each do |error|
          #   list_elements << template.content_tag(:li, Formtastic::Util.html_safe(error.html_safe))
          # end
          # template.content_tag(:ul, Formtastic::Util.html_safe(list_elements.join("\n")), :class => error_class)
        end
        
        def error_first_html(inline_or_block = :inline)
          error_class = if inline_or_block == :inline
            options[:error_class] || builder.default_inline_error_class
          else
            options[:error_class] || builder.default_block_error_class
          end
          template.content_tag(:span, Formtastic::Util.html_safe(errors.first.untaint), :class => error_class)
        end

        def error_none_html(ignore)
          # super
          ""
        end

      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
flexa_lib-0.5.2 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.5.1 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.5.0 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.9 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.8 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.7 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.6 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.5 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.4 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.3 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.2 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.1 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.3.0 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.9 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.8 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.7 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.6 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.5 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.4 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb
flexa_lib-0.2.3 lib/flexa_formtastic_bootstrap/inputs/base/errors.rb