Sha256: 369cd1a3a9c4b18a8206b5e72585f8cf859218f5073bd087372352ca612be153

Contents?: true

Size: 1.02 KB

Versions: 43

Compression:

Stored size: 1.02 KB

Contents

module ActiveAdmin
  module Inputs
    module Filters
      module Base
        include ::Formtastic::Inputs::Base
        include ::ActiveAdmin::Filters::FormtasticAddons

        extend ::ActiveSupport::Autoload
        autoload :SearchMethodSelect

        def input_wrapping(&block)
          template.content_tag :div, template.capture(&block), wrapper_html_options
        end

        def required?
          false
        end

        # Can pass proc to filter label option
        def label_from_options
          res = super
          res = res.call if res.is_a? Proc
          res
        end

        def wrapper_html_options
          opts = super
          (opts[:class] ||= '') << " filter_form_field filter_#{as}"
          opts
        end

        # Override the standard finder to accept a proc
        def collection_from_options
          if options[:collection].is_a?(Proc)
            template.instance_exec(&options[:collection])
          else
            super
          end
        end

      end
    end
  end
end

Version data entries

43 entries across 43 versions & 5 rubygems

Version Path
activeadmin-rails-1.7.1 lib/active_admin/inputs/filters/base.rb
activeadmin-rails-1.7.0 lib/active_admin/inputs/filters/base.rb
activeadmin-rb-1.6.0 lib/active_admin/inputs/filters/base.rb
activeadmin-rb-1.5.2 lib/active_admin/inputs/filters/base.rb
activeadmin-2.8.0 lib/active_admin/inputs/filters/base.rb
activeadmin-rb-1.5.1 lib/active_admin/inputs/filters/base.rb
activeadmin-2.7.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.6.1 lib/active_admin/inputs/filters/base.rb
activeadmin-2.6.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.5.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.4.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.3.1 lib/active_admin/inputs/filters/base.rb
activeadmin-2.3.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.2.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.1.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.0.0 lib/active_admin/inputs/filters/base.rb
activeadmin-rb-1.5.0 lib/active_admin/inputs/filters/base.rb
activeadmin-2.0.0.rc2 lib/active_admin/inputs/filters/base.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/active_admin/inputs/filters/base.rb
activeadmin-2.0.0.rc1 lib/active_admin/inputs/filters/base.rb