Class: Datagrid::Filters::BooleanEnumFilter

Inherits:
EnumFilter show all
Defined in:
lib/datagrid/filters/boolean_enum_filter.rb

Overview

:nodoc:

Constant Summary collapse

YES =
"YES"
NO =
"NO"

Instance Attribute Summary

Attributes inherited from BaseFilter

#block, #grid_class, #name, #options

Instance Method Summary collapse

Methods inherited from EnumFilter

#checkboxes?, #parse, #strict

Methods included from SelectOptions

#include_blank, #prompt, #select

Methods inherited from BaseFilter

#allow_blank?, #allow_nil?, #apply, #default, #default_filter_block, #dummy?, #enabled?, form_builder_helper_name, #form_builder_helper_name, #format, #header, #multiple?, #parse, #parse_values, #separator, #supports_range?, #type, #unapplicable_value?

Constructor Details

#initialize(report, attribute, options = {}, &block) ⇒ BooleanEnumFilter

Returns a new instance of BooleanEnumFilter.


6
7
8
9
10
11
# File 'lib/datagrid/filters/boolean_enum_filter.rb', line 6

def initialize(report, attribute, options = {}, &block)
  options[:select] = [YES, NO].map do |key, value|
    [I18n.t("datagrid.filters.eboolean.#{key.downcase}", :default => key.downcase.capitalize), key]
  end
  super(report, attribute, options, &block)
end

Instance Method Details

#checkbox_id(value) ⇒ Object


14
15
16
# File 'lib/datagrid/filters/boolean_enum_filter.rb', line 14

def checkbox_id(value)
  [object_name, name, value].join('_').underscore 
end