Class: Trestle::Form::Fields::DatetimeSelect
- Inherits:
-
Trestle::Form::Field
- Object
- Trestle::Form::Field
- Trestle::Form::Fields::DatetimeSelect
- Defined in:
- lib/trestle/form/fields/datetime_select.rb
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
Attributes inherited from Trestle::Form::Field
#block, #builder, #name, #options, #template
Instance Method Summary collapse
- #default_html_options ⇒ Object
- #field ⇒ Object
-
#initialize(builder, template, name, options = {}, html_options = {}, &block) ⇒ DatetimeSelect
constructor
A new instance of DatetimeSelect.
Methods inherited from Trestle::Form::Field
#defaults, #disabled?, #errors, #form_group, #normalize_options!, #readonly?, #render
Constructor Details
#initialize(builder, template, name, options = {}, html_options = {}, &block) ⇒ DatetimeSelect
Returns a new instance of DatetimeSelect.
7 8 9 10 11 |
# File 'lib/trestle/form/fields/datetime_select.rb', line 7 def initialize(builder, template, name, ={}, ={}, &block) super(builder, template, name, , &block) @html_options = .merge() end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
5 6 7 |
# File 'lib/trestle/form/fields/datetime_select.rb', line 5 def @html_options end |
Instance Method Details
#default_html_options ⇒ Object
19 20 21 |
# File 'lib/trestle/form/fields/datetime_select.rb', line 19 def Trestle::Options.new(class: ["form-select"], disabled: readonly?, data: { controller: "select" }) end |
#field ⇒ Object
13 14 15 16 17 |
# File 'lib/trestle/form/fields/datetime_select.rb', line 13 def field tag.div(class: "datetime-select") do builder.raw_datetime_select(name, , , &block) end end |