Class: UI::SliderTrack
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SliderTrack
- Includes:
- SliderTrackBehavior
- Defined in:
- app/components/ui/slider_track.rb
Overview
SliderTrack - Phlex implementation
The track is the background rail that contains the range. Uses SliderTrackBehavior module for shared logic.
Instance Method Summary collapse
-
#initialize(classes: "", attributes: {}) ⇒ SliderTrack
constructor
A new instance of SliderTrack.
- #view_template(&block) ⇒ Object
Methods included from SliderTrackBehavior
Constructor Details
#initialize(classes: "", attributes: {}) ⇒ SliderTrack
Returns a new instance of SliderTrack.
17 18 19 20 |
# File 'app/components/ui/slider_track.rb', line 17 def initialize(classes: "", attributes: {}) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/components/ui/slider_track.rb', line 22 def view_template(&block) all_attributes = # Merge data attributes all_attributes[:data] = all_attributes[:data].merge(@attributes.fetch(:data, {})) # Merge with user attributes (except data which we already handled) all_attributes = all_attributes.merge(@attributes.except(:data)) div(**all_attributes) do yield if block_given? end end |