Sha256: fa6ba95b07bcec6545f3c7c1c529812f58ed84b6413c2bab70ed05dec16ad14c

Contents?: true

Size: 989 Bytes

Versions: 20

Compression:

Stored size: 989 Bytes

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
          { class: "filter_form_field filter_#{as}" }
        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

20 entries across 20 versions & 3 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/inputs/filters/base.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.17.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.16.pre lib/active_admin/inputs/filters/base.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/inputs/filters/base.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/inputs/filters/base.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.15.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.14.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.13.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.12.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.11.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.10.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.9.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.8.pre lib/active_admin/inputs/filters/base.rb
activeadmin-1.0.0.pre2 lib/active_admin/inputs/filters/base.rb
activeadmin-1.0.0.pre1 lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.7.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.6.pre lib/active_admin/inputs/filters/base.rb
yousty-activeadmin-1.0.5.pre lib/active_admin/inputs/filters/base.rb