Class: ActiveAdmin::Filters::Humanized

Inherits:
Object
  • Object
show all
Includes:
ViewHelpers
Defined in:
lib/active_admin/filters/humanized.rb

Constant Summary

Constants included from ViewHelpers::DisplayHelper

ViewHelpers::DisplayHelper::DISPLAY_NAME_FALLBACK

Instance Method Summary collapse

Methods included from ViewHelpers::FlashHelper

#flash_messages

Methods included from ViewHelpers::ViewFactoryHelper

#view_factory

Methods included from ViewHelpers::TitleHelper

#title

Methods included from ViewHelpers::FormHelper

#active_admin_form_for, #fields_for_params, #hidden_field_tags_for

Methods included from ViewHelpers::SidebarHelper

#skip_sidebar!, #skip_sidebar?

Methods included from MethodOrProcHelper

#call_method_or_exec_proc, #call_method_or_proc_on, #render_in_context, #render_or_call_method_or_proc_on

Methods included from ViewHelpers::DisplayHelper

#association_methods_for, #boolean_attr?, #display_name, #display_name_method_for, #find_value, #format_attribute, #pretty_format, #reflection_for

Methods included from ViewHelpers::BreadcrumbHelper

#breadcrumb_links

Methods included from ViewHelpers::AutoLinkHelper

#active_admin_resource_for, #auto_link, #auto_url_for

Methods included from ViewHelpers::ActiveAdminApplicationHelper

#active_admin_application

Constructor Details

#initialize(param) ⇒ Humanized

Returns a new instance of Humanized.


7
8
9
10
# File 'lib/active_admin/filters/humanized.rb', line 7

def initialize(param)
  @body = param[0]
  @value = param[1]
end

Instance Method Details

#bodyObject


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_admin/filters/humanized.rb', line 16

def body
  predicate = ransack_predicate_translation

  if current_predicate.nil?
    predicate = @body.titleize
  elsif translation_missing?(predicate)
    predicate = active_admin_predicate_translation
  end

  "#{parse_parameter_body} #{predicate}".strip
end

#valueObject


12
13
14
# File 'lib/active_admin/filters/humanized.rb', line 12

def value
  @value.is_a?(::Array) ? @value.compact.join(', ') : @value
end