Sha256: 2c0776028971a3daa9493b4f5e07fd59b6be015046bab3159a16a4068f2a2352

Contents?: true

Size: 1.14 KB

Versions: 63

Compression:

Stored size: 1.14 KB

Contents

module ActiveAdmin
  module Inputs
    module Filters
      class CheckBoxesInput < ::Formtastic::Inputs::CheckBoxesInput
        include Base

        def input_name
          "#{object_name}[#{searchable_method_name}_in][]"
        end

        def selected_values
          @object.public_send("#{searchable_method_name}_in") || []
        end

        def searchable_method_name
          if searchable_has_many_through?
            "#{reflection.through_reflection.name}_#{reflection.foreign_key}"
          else
            association_primary_key || method
          end
        end

        # Add whitespace before label
        def choice_label(choice)
          ' ' + super
        end

        # Don't wrap in UL tag
        def choices_group_wrapping(&block)
          template.capture(&block)
        end

        # Don't wrap in LI tag
        def choice_wrapping(html_options, &block)
          template.capture(&block)
        end

        # Don't render hidden fields
        def hidden_field_for_all
          ""
        end

        # Don't render hidden fields
        def hidden_fields?
          false
        end
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 6 rubygems

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