Class: StimulusPlumbers::Components::Combobox::Time
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Combobox::Time
- Defined in:
- lib/stimulus_plumbers/components/combobox/time.rb,
lib/stimulus_plumbers/components/combobox/time/drum.rb
Defined Under Namespace
Classes: Drum
Constant Summary collapse
- STIMULUS_CONTROLLER =
"combobox-time"
Constants included from Plumber::HtmlOptions
Plumber::HtmlOptions::STIMULUS_SPACEJOIN_KEYS
Instance Attribute Summary
Attributes inherited from Plumber::Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Plumber::Base
Methods included from Plumber::HtmlOptions
#merge_data_options, #merge_html_options, #merge_string_option, #normalize_part
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Class Method Details
.default_opts ⇒ Object
9 10 11 12 13 |
# File 'lib/stimulus_plumbers/components/combobox/time.rb', line 9 def self.default_opts { popover: { label: "Picker", role: "dialog", tag: :div } } end |
Instance Method Details
#render(format: :h12, step: 1, value: nil, **_kwargs) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stimulus_plumbers/components/combobox/time.rb', line 15 def render(format: :h12, step: 1, value: nil, **_kwargs) @format = format @step = [1, step.to_i].max @time = parse_time(value) template.content_tag( :div, **( { classes: theme.resolve(:combobox_time).fetch(:classes, "") }, { data: { controller: STIMULUS_CONTROLLER, action: "#{STIMULUS_CONTROLLER}:selected->#{Combobox::STIMULUS_CONTROLLER}#onSelect" } } ) ) do template.safe_join(drums) end end |