Sha256: dda02a8ef5dfbcfd86ec5f460de2ed0082950123d4c1d5b6f14f4304a50bd8e4

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 Bytes

Contents

module Formtastic
  module Inputs

    class RegexInput < Formtastic::Inputs::StringInput
      def input_html_options

        {
            class: 'regex-input',
            data: {
                regex: options[:regex],
                example: options[:example]
            },
            placeholder_text: options[:example]
        }
      end

      # Overwrite default li tag
      def input_wrapping(&block)
        template.content_tag(:div,
                            [template.capture(&block), error_html, hint_html].join("\n").html_safe,
                            wrapper_html_options
        )
      end

      # Overwrite wrapper html by the active admin class
      def wrapper_html_options
        super.merge(:class => 'filter_form_field filter_string')
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activeadmin-regex-input-0.2.2 lib/formtastic/regex-input.rb
activeadmin-regex-input-0.2.1 lib/formtastic/regex-input.rb
activeadmin-regex-input-0.2.0 lib/formtastic/regex-input.rb
activeadmin-regex-input-0.1.1 lib/formtastic/regex-input.rb
activeadmin-regex-input-0.1.0 lib/formtastic/regex-input.rb
activeadmin-regex-input-0.0.0 lib/formtastic/regex-input.rb