Class: GovukComponent::FeedbackComponent
- Inherits:
-
Base
- Object
- Base
- GovukComponent::FeedbackComponent
- Defined in:
- app/components/govuk_component/feedback_component.rb
Instance Attribute Summary collapse
-
#heading_level ⇒ Object
readonly
Returns the value of attribute heading_level.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title_text ⇒ Object
readonly
Returns the value of attribute title_text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title_text: nil, text: nil, heading_level: 2, classes: [], html_attributes: {}) ⇒ FeedbackComponent
constructor
A new instance of FeedbackComponent.
Constructor Details
#initialize(title_text: nil, text: nil, heading_level: 2, classes: [], html_attributes: {}) ⇒ FeedbackComponent
Returns a new instance of FeedbackComponent.
7 8 9 10 11 12 13 |
# File 'app/components/govuk_component/feedback_component.rb', line 7 def initialize(title_text: nil, text: nil, heading_level: 2, classes: [], html_attributes: {}) @title_text = title_text @text = text @heading_level = %(h#{heading_level}) super(classes:, html_attributes:) end |
Instance Attribute Details
#heading_level ⇒ Object (readonly)
Returns the value of attribute heading_level.
2 3 4 |
# File 'app/components/govuk_component/feedback_component.rb', line 2 def heading_level @heading_level end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/feedback_component.rb', line 2 def text @text end |
#title_text ⇒ Object (readonly)
Returns the value of attribute title_text.
2 3 4 |
# File 'app/components/govuk_component/feedback_component.rb', line 2 def title_text @title_text end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/components/govuk_component/feedback_component.rb', line 15 def call tag.div(**html_attributes) do tag.div(class: "#{brand}-grid-row") do tag.div(class: "#{brand}-grid-column-two-thirds") do safe_join([title_content, text_content]) end end end end |