Sha256: 3766b827a7d7cc24ffd1e8c45dc755a6df2401004e1dfdaf61253eaaab709426
Contents?: true
Size: 873 Bytes
Versions: 3
Compression:
Stored size: 873 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 def boolean_checked?(value, checked_value) defined?(super) ? super : ActionView::Helpers::InstanceTag.check_box_checked?(value, checked_value) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems