Sha256: 71fadab8a7bce50573c4f888aa5182f53a71dcc5b268d16c500312f76fa8d2b0

Contents?: true

Size: 575 Bytes

Versions: 46

Compression:

Stored size: 575 Bytes

Contents

module ActiveAdmin
  module Inputs
    class FilterStringInput < ::Formtastic::Inputs::StringInput
      include FilterBase

      def to_html
        input_wrapping do
          label_html <<
          builder.text_field(input_name, input_html_options)
        end
      end

      def label_text
        I18n.t('active_admin.search_field', :field => super)
      end

      def input_name
        method.to_s.match(metasearch_conditions) ? method : "#{method}_contains"
      end

      def metasearch_conditions
        /starts_with|ends_with/
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.141 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.128 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/lib/active_admin/inputs/filter_string_input.rb