Class: Trestle::Form::Fields::TimeSelect
- Inherits:
-
Trestle::Form::Field
- Object
- Trestle::Form::Field
- Trestle::Form::Fields::TimeSelect
- Defined in:
- lib/trestle/form/fields/time_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) ⇒ TimeSelect
constructor
A new instance of TimeSelect.
Methods inherited from Trestle::Form::Field
#defaults, #errors, #form_group, #normalize_options!, #readonly?, #render
Constructor Details
#initialize(builder, template, name, options = {}, html_options = {}, &block) ⇒ TimeSelect
Returns a new instance of TimeSelect.
7 8 9 10 11 |
# File 'lib/trestle/form/fields/time_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/time_select.rb', line 5 def @html_options end |
Instance Method Details
#default_html_options ⇒ Object
19 20 21 |
# File 'lib/trestle/form/fields/time_select.rb', line 19 def Trestle::Options.new(class: ["form-control"], disabled: readonly?, data: { enable_select2: true }) end |
#field ⇒ Object
13 14 15 16 17 |
# File 'lib/trestle/form/fields/time_select.rb', line 13 def field content_tag(:div, class: "time-select") do builder.raw_time_select(name, , , &block) end end |