Sha256: 3e8ce05560fe8ea8125efd8824383184c5813c7e72137e2376d5b2505d719413

Contents?: true

Size: 692 Bytes

Versions: 10

Compression:

Stored size: 692 Bytes

Contents

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

      filter :contains, :equals, :starts_with, :ends_with

      # If the filter method includes a search condition, build a normal string search field.
      # Else, build a search field with a companion dropdown to choose a search condition from.
      def to_html
        if seems_searchable?
          input_wrapping do
            label_html <<
            builder.text_field(method, input_html_options)
          end
        else
          super # SearchMethodSelect#to_html
        end
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
yousty-activeadmin-1.0.4.pre lib/active_admin/inputs/filter_string_input.rb
yousty-activeadmin-1.0.3.pre lib/active_admin/inputs/filter_string_input.rb
active_administration-0.0.3 lib/active_admin/inputs/filter_string_input.rb
activeadministration-0.0.2 lib/active_admin/inputs/filter_string_input.rb
active_administration-0.0.2 lib/active_admin/inputs/filter_string_input.rb
activeadministration-0.0.1 lib/active_admin/inputs/filter_string_input.rb
active_administration-0.0.1 lib/active_admin/inputs/filter_string_input.rb
yousty-activeadmin-1.0.2.pre lib/active_admin/inputs/filter_string_input.rb
yousty-activeadmin-1.0.1.pre lib/active_admin/inputs/filter_string_input.rb
yousty-activeadmin-1.0.0.pre lib/active_admin/inputs/filter_string_input.rb