Sha256: ae2a8192bbccc68a124ea35281bfc797350d6698fbb92b36ec862182639e1bad

Contents?: true

Size: 863 Bytes

Versions: 7

Compression:

Stored size: 863 Bytes

Contents

module ActiveAdmin
  module Inputs
    class FilterCheckBoxesInput < ::Formtastic::Inputs::CheckBoxesInput
      include FilterBase

      def input_name
        "#{object_name}[#{association_primary_key || method}_in][]"
      end

      def selected_values
        @object.send("#{association_primary_key || method}_in") || []
      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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
activeadmin-0.6.6 lib/active_admin/inputs/filter_check_boxes_input.rb
activeadmin-0.6.5 lib/active_admin/inputs/filter_check_boxes_input.rb
activeadmin-0.6.4 lib/active_admin/inputs/filter_check_boxes_input.rb
activeadmin-0.6.3 lib/active_admin/inputs/filter_check_boxes_input.rb
activeadmin-0.6.2 lib/active_admin/inputs/filter_check_boxes_input.rb
activeadmin-0.6.1 lib/active_admin/inputs/filter_check_boxes_input.rb
aa-rails4-0.6.0 lib/active_admin/inputs/filter_check_boxes_input.rb