Class: GovukComponent::NotificationBannerComponent
- Defined in:
- app/components/govuk_component/notification_banner_component.rb
Defined Under Namespace
Classes: Heading
Instance Attribute Summary collapse
-
#disable_auto_focus ⇒ Object
readonly
Returns the value of attribute disable_auto_focus.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title_heading_level ⇒ Object
readonly
Returns the value of attribute title_heading_level.
-
#title_id ⇒ Object
readonly
Returns the value of attribute title_id.
-
#title_text ⇒ Object
readonly
Returns the value of attribute title_text.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(title_text: nil, text: nil, role: nil, success: config.default_notification_title_success, title_heading_level: config.default_notification_title_heading_level, title_id: config.default_notification_banner_title_id, disable_auto_focus: config.default_notification_disable_auto_focus, classes: [], html_attributes: {}) ⇒ NotificationBannerComponent
constructor
A new instance of NotificationBannerComponent.
- #render? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(title_text: nil, text: nil, role: nil, success: config.default_notification_title_success, title_heading_level: config.default_notification_title_heading_level, title_id: config.default_notification_banner_title_id, disable_auto_focus: config.default_notification_disable_auto_focus, classes: [], html_attributes: {}) ⇒ NotificationBannerComponent
Returns a new instance of NotificationBannerComponent.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 7 def initialize( title_text: nil, text: nil, role: nil, success: config.default_notification_title_success, title_heading_level: config.default_notification_title_heading_level, title_id: config., disable_auto_focus: config.default_notification_disable_auto_focus, classes: [], html_attributes: {} ) @title_text = title_text @title_id = title_id @text = text @success = success @role = role || default_role @title_heading_level = title_heading_level @disable_auto_focus = disable_auto_focus super(classes:, html_attributes:) end |
Instance Attribute Details
#disable_auto_focus ⇒ Object (readonly)
Returns the value of attribute disable_auto_focus.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def disable_auto_focus @disable_auto_focus end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def role @role end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def success @success end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def text @text end |
#title_heading_level ⇒ Object (readonly)
Returns the value of attribute title_heading_level.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def title_heading_level @title_heading_level end |
#title_id ⇒ Object (readonly)
Returns the value of attribute title_id.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def title_id @title_id end |
#title_text ⇒ Object (readonly)
Returns the value of attribute title_text.
2 3 4 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 2 def title_text @title_text end |
Instance Method Details
#render? ⇒ Boolean
29 30 31 |
# File 'app/components/govuk_component/notification_banner_component.rb', line 29 def render? headings.any? || text.present? || content? end |