Class: TaoForm::Components::DatetimePickerComponent
- Inherits:
-
FieldComponent
- Object
- TaoOnRails::Components::Base
- FieldComponent
- TaoForm::Components::DatetimePickerComponent
- Defined in:
- lib/tao_form/components/datetime_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.
-
#time_picker_options ⇒ Object
readonly
Returns the value of attribute time_picker_options.
-
#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 = {}) ⇒ DatetimePickerComponent
constructor
A new instance of DatetimePickerComponent.
- #render(&block) ⇒ Object
- #render_date_picker ⇒ Object
- #render_time_picker ⇒ Object
Constructor Details
#initialize(view, builder, attribute_name, options = {}) ⇒ DatetimePickerComponent
Returns a new instance of DatetimePickerComponent.
7 8 9 10 11 12 13 14 |
# File 'lib/tao_form/components/datetime_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/datetime_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/datetime_picker_component.rb', line 5 def disabled @disabled end |
#time_picker_options ⇒ Object (readonly)
Returns the value of attribute time_picker_options.
5 6 7 |
# File 'lib/tao_form/components/datetime_picker_component.rb', line 5 def @time_picker_options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/tao_form/components/datetime_picker_component.rb', line 5 def value @value end |
Class Method Details
.component_name ⇒ Object
38 39 40 |
# File 'lib/tao_form/components/datetime_picker_component.rb', line 38 def self.component_name :datetime_picker end |
Instance Method Details
#render(&block) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/tao_form/components/datetime_picker_component.rb', line 16 def render &block if block_given? super else super { builder.send :datetime_field, attribute_name, } end end |
#render_date_picker ⇒ Object
26 27 28 29 30 |
# File 'lib/tao_form/components/datetime_picker_component.rb', line 26 def render_date_picker view.tao_date_picker do view.date_field_tag nil, nil, class: 'date-field', disabled: disabled end end |
#render_time_picker ⇒ Object
32 33 34 35 36 |
# File 'lib/tao_form/components/datetime_picker_component.rb', line 32 def render_time_picker view.tao_time_picker do view.time_field_tag nil, nil, class: 'time-field', disabled: disabled end end |