Class: DsfrComponent::Base
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- DsfrComponent::Base
- Defined in:
- app/components/dsfr_component/base.rb
Direct Known Subclasses
AccordionComponent, AccordionComponent::SectionComponent, AlertComponent, BadgeComponent, BreadcrumbsComponent, ButtonComponent, HeaderComponent, HeaderComponent::DirectLinkComponent, HeaderComponent::DirectLinkDropdownComponent, HeaderComponent::OperatorImageComponent, HeaderComponent::ToolLinkComponent, ModalComponent, StepperComponent, TabsComponent, TabsComponent::TabComponent, TagComponent, TileComponent
Constant Summary collapse
- HEADING_LEVELS =
[1, 2, 3, 4, 5, 6].freeze
Instance Attribute Summary collapse
-
#html_attributes ⇒ Object
readonly
Returns the value of attribute html_attributes.
Instance Method Summary collapse
-
#initialize(classes:, html_attributes:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(classes:, html_attributes:) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/dsfr_component/base.rb', line 10 def initialize(classes:, html_attributes:) if classes.nil? Rails.logger.warn("classes is nil, if no custom classes are needed omit the param") classes = [] end # FIXME: remove first merge when we deprecate classes # # This step only needs to be here while we still accept classes:, now # we're using html_attributes_utils we can start to move towards # supporting html_attributes: { class: 'xyz' } over taking them # separately @html_attributes = default_attributes .deep_merge_html_attributes({ class: classes }) .deep_merge_html_attributes(html_attributes) .deep_tidy_html_attributes super end |
Instance Attribute Details
#html_attributes ⇒ Object (readonly)
Returns the value of attribute html_attributes.
4 5 6 |
# File 'app/components/dsfr_component/base.rb', line 4 def html_attributes @html_attributes end |