Class: TaoForm::Components::DateRangePickerComponent
- Inherits:
-
FieldComponent
- Object
- TaoOnRails::Components::Base
- FieldComponent
- TaoForm::Components::DateRangePickerComponent
- Defined in:
- lib/tao_form/components/date_range_picker_component.rb
Instance Attribute Summary collapse
-
#date_picker_options ⇒ Object
readonly
Returns the value of attribute date_picker_options.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from FieldComponent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, builder, attribute_name, options = {}) ⇒ DateRangePickerComponent
constructor
A new instance of DateRangePickerComponent.
- #render(&block) ⇒ Object
- #render_date_picker(name) ⇒ Object
Constructor Details
#initialize(view, builder, attribute_name, options = {}) ⇒ DateRangePickerComponent
Returns a new instance of DateRangePickerComponent.
7 8 9 10 11 12 13 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 7 def initialize view, builder, attribute_name, = {} super view, builder, attribute_name, @value = @options.delete(:value) @disabled = @options[:disabled].presence || false end |
Instance Attribute Details
#date_picker_options ⇒ Object (readonly)
Returns the value of attribute date_picker_options.
5 6 7 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 5 def @date_picker_options end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
5 6 7 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 5 def disabled @disabled end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 5 def value @value end |
Class Method Details
.component_name ⇒ Object
35 36 37 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 35 def self.component_name :date_range_picker end |
Instance Method Details
#render(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 15 def render &block if block_given? super else super { builder.hidden_field attribute_name, } end end |
#render_date_picker(name) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/tao_form/components/date_range_picker_component.rb', line 25 def render_date_picker name opts = , { class: "#{name}-date-picker", placeholder: t("#{name}_placeholder") } view.tao_date_picker opts do view.date_field_tag nil, nil, class: "#{name}-date-field", disabled: disabled end end |