Class: ActiveScaffold::DataStructures::FilterOption

Inherits:
ActionLink show all
Defined in:
lib/active_scaffold/data_structures/filter_option.rb

Constant Summary

Constants inherited from ActionLink

ActionLink::NO_OPTIONS

Instance Attribute Summary collapse

Attributes inherited from ActionLink

#action, #column, #confirm, #controller, #controller_actions, #crud_type, #dynamic_parameters, #html_options, #ignore_method, #image, #keep_open, #label, #method, #parameters, #position, #prompt, #prompt_required, #refresh_on_close, #security_method, #toggle, #type, #weight

Instance Method Summary collapse

Methods inherited from ActionLink

#confirm?, #freeze, #initialize_copy, #inline=, #inline?, #keep_open?, #name_to_cache, #nested_link?, #page=, #page?, #popup=, #popup?, #prompt?, #prompt_required?, #security_method_set?, #static_controller?

Constructor Details

#initialize(filter_name, name, options = {}) ⇒ FilterOption

Returns a new instance of FilterOption.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_scaffold/data_structures/filter_option.rb', line 7

def initialize(filter_name, name, options = {})
  @filter_name = filter_name
  @label = @name = name.to_sym
  super(
    :index,
    options.merge(
      action: :index,
      type: :collection,
      method: :get,
      position: false,
      toggle: true
    )
  )
  parameters.merge!(filter_name => name)
end

Instance Attribute Details

#conditionsObject

Returns the value of attribute conditions.



5
6
7
# File 'lib/active_scaffold/data_structures/filter_option.rb', line 5

def conditions
  @conditions
end

#descriptionObject



23
24
25
26
27
28
29
30
# File 'lib/active_scaffold/data_structures/filter_option.rb', line 23

def description
  case @description
  when Symbol
    ActiveScaffold::Registry.cache(:translations, @description) { as_(@description) }
  else
    @description
  end
end

#filter_nameObject (readonly)

Returns the value of attribute filter_name.



3
4
5
# File 'lib/active_scaffold/data_structures/filter_option.rb', line 3

def filter_name
  @filter_name
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/active_scaffold/data_structures/filter_option.rb', line 3

def name
  @name
end