Class: FoxTail::ProgressBarComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- Base
- BaseComponent
- FoxTail::ProgressBarComponent
- Includes:
- Concerns::HasStimulusController
- Defined in:
- app/components/fox_tail/progress_bar_component.rb
Defined Under Namespace
Classes: StimulusController
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from BaseComponent
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(value, html_attributes = {}) ⇒ ProgressBarComponent
constructor
A new instance of ProgressBarComponent.
- #stimulus_controller_options ⇒ Object
- #use_stimulus? ⇒ Boolean
Methods inherited from BaseComponent
classname_merger, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
Constructor Details
#initialize(value, html_attributes = {}) ⇒ ProgressBarComponent
Returns a new instance of ProgressBarComponent.
13 14 15 16 |
# File 'app/components/fox_tail/progress_bar_component.rb', line 13 def initialize(value, html_attributes = {}) super(html_attributes) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'app/components/fox_tail/progress_bar_component.rb', line 6 def value @value end |
Instance Method Details
#before_render ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/components/fox_tail/progress_bar_component.rb', line 18 def before_render super html_attributes[:class] = classnames theme.apply(:root, self), html_class html_attributes[:aria] ||= {} html_attributes[:aria][:valuenow] = value html_attributes[:aria][:valuemin] = 0 html_attributes[:aria][:valuemax] = 100 end |
#call ⇒ Object
28 29 30 31 32 |
# File 'app/components/fox_tail/progress_bar_component.rb', line 28 def call content_tag :div, html_attributes do content_tag :div, label, end end |
#stimulus_controller_options ⇒ Object
38 39 40 |
# File 'app/components/fox_tail/progress_bar_component.rb', line 38 def {value: value, update_label: show_label? && !content?} end |
#use_stimulus? ⇒ Boolean
34 35 36 |
# File 'app/components/fox_tail/progress_bar_component.rb', line 34 def use_stimulus? controlled? && super end |