Class: YummyGuide::Administrate::Filters::Base
- Inherits:
-
Object
- Object
- YummyGuide::Administrate::Filters::Base
- Defined in:
- lib/yummy_guide/administrate/filters.rb
Direct Known Subclasses
Checkbox, CheckboxGroup, Custom, DateRange, DatetimeLocalRange, DatetimeRange, RadioGroup, Select, Text
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #label_text(view_context, locals) ⇒ Object
- #row(view_context, form, scope, current_values, locals) ⇒ Object
- #visible?(view_context, locals) ⇒ Boolean
- #with_name(name) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/yummy_guide/administrate/filters.rb', line 13 def initialize( = {}) @options = .symbolize_keys end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/yummy_guide/administrate/filters.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/yummy_guide/administrate/filters.rb', line 7 def @options end |
Class Method Details
.with_options(options = {}) ⇒ Object
9 10 11 |
# File 'lib/yummy_guide/administrate/filters.rb', line 9 def self.( = {}) new() end |
Instance Method Details
#label_text(view_context, locals) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/yummy_guide/administrate/filters.rb', line 38 def label_text(view_context, locals) evaluated_label = evaluate_option([:label], view_context, locals) return evaluated_label if evaluated_label.present? name.to_s.humanize end |
#row(view_context, form, scope, current_values, locals) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/yummy_guide/administrate/filters.rb', line 28 def row(view_context, form, scope, current_values, locals) view_context.content_tag(:tr) do view_context.safe_join([ label_cell(view_context, form, locals), input_cell(view_context, form, scope, current_values, locals), clear_cell(view_context) ]) end end |
#visible?(view_context, locals) ⇒ Boolean
23 24 25 26 |
# File 'lib/yummy_guide/administrate/filters.rb', line 23 def visible?(view_context, locals) condition = .fetch(:if, true) evaluate_option(condition, view_context, locals) != false end |
#with_name(name) ⇒ Object
17 18 19 20 21 |
# File 'lib/yummy_guide/administrate/filters.rb', line 17 def with_name(name) copy = dup copy.instance_variable_set(:@name, name.to_sym) copy end |