Class: GovukComponent::ExitThisPageComponent
- Defined in:
- app/components/govuk_component/exit_this_page_component.rb
Instance Attribute Summary collapse
-
#activated_text ⇒ Object
readonly
Returns the value of attribute activated_text.
-
#press_one_more_time_text ⇒ Object
readonly
Returns the value of attribute press_one_more_time_text.
-
#press_two_more_times_text ⇒ Object
readonly
Returns the value of attribute press_two_more_times_text.
-
#redirect_url ⇒ Object
readonly
Returns the value of attribute redirect_url.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#timed_out_text ⇒ Object
readonly
Returns the value of attribute timed_out_text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(redirect_url: nil, href: nil, text: config.default_exit_this_page_text, activated_text: config.default_exit_this_page_activated_text, timed_out_text: config.default_exit_this_page_timed_out_text, press_two_more_times_text: config.default_exit_this_page_press_two_more_times_text, press_one_more_time_text: config.default_exit_this_page_press_one_more_time_text, classes: [], html_attributes: {}) ⇒ ExitThisPageComponent
constructor
A new instance of ExitThisPageComponent.
Methods inherited from Base
Constructor Details
#initialize(redirect_url: nil, href: nil, text: config.default_exit_this_page_text, activated_text: config.default_exit_this_page_activated_text, timed_out_text: config.default_exit_this_page_timed_out_text, press_two_more_times_text: config.default_exit_this_page_press_two_more_times_text, press_one_more_time_text: config.default_exit_this_page_press_one_more_time_text, classes: [], html_attributes: {}) ⇒ ExitThisPageComponent
Returns a new instance of ExitThisPageComponent.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 4 def initialize( redirect_url: nil, href: nil, text: config.default_exit_this_page_text, activated_text: config.default_exit_this_page_activated_text, timed_out_text: config.default_exit_this_page_timed_out_text, press_two_more_times_text: config.default_exit_this_page_press_two_more_times_text, press_one_more_time_text: config.default_exit_this_page_press_one_more_time_text, classes: [], html_attributes: {} ) fail(ArgumentError, "provide either redirect_url or href, not both") if redirect_url.present? && href.present? @text = text @redirect_url = href || redirect_url || config.default_exit_this_page_redirect_url || fail(ArgumentError, "no redirect_url provided") @activated_text = activated_text @timed_out_text = timed_out_text @press_two_more_times_text = press_two_more_times_text @press_one_more_time_text = press_one_more_time_text super(classes:, html_attributes:) end |
Instance Attribute Details
#activated_text ⇒ Object (readonly)
Returns the value of attribute activated_text.
2 3 4 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 2 def activated_text @activated_text end |
#press_one_more_time_text ⇒ Object (readonly)
Returns the value of attribute press_one_more_time_text.
2 3 4 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 2 def press_one_more_time_text @press_one_more_time_text end |
#press_two_more_times_text ⇒ Object (readonly)
Returns the value of attribute press_two_more_times_text.
2 3 4 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 2 def press_two_more_times_text @press_two_more_times_text end |
#redirect_url ⇒ Object (readonly)
Returns the value of attribute redirect_url.
2 3 4 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 2 def redirect_url @redirect_url end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 2 def text @text end |
#timed_out_text ⇒ Object (readonly)
Returns the value of attribute timed_out_text.
2 3 4 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 2 def timed_out_text @timed_out_text end |
Instance Method Details
#call ⇒ Object
27 28 29 |
# File 'app/components/govuk_component/exit_this_page_component.rb', line 27 def call tag.div(exit_this_page_content, **html_attributes) end |