Sha256: 030be1bdd9f5d331baadbbb44f2dcf034dbd85286e9276b3e7d4e4ec19844c6f

Contents?: true

Size: 705 Bytes

Versions: 3

Compression:

Stored size: 705 Bytes

Contents

module ActiveAdmin
  module Inputs
    class FilterBooleanInput < ::Formtastic::Inputs::BooleanInput
      include FilterBase

      def to_html
        input_wrapping do
          [ label_html,
            check_box_html
          ].join("\n").html_safe
        end
      end

      def search_method
        method.to_s.match(search_conditions) ? method : "#{method}_eq"
      end

      def checked?
        object && boolean_checked?(object.send(search_method), checked_value)
      end

      def input_html_options
        { :name => "q[#{ search_method }]" }
      end

      def search_conditions
        /(is_true|is_false|is_present|is_blank|is_null|is_not_null)\z/
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-0.6.3 lib/active_admin/inputs/filter_boolean_input.rb
activeadmin-0.6.2 lib/active_admin/inputs/filter_boolean_input.rb
activeadmin-0.6.1 lib/active_admin/inputs/filter_boolean_input.rb