diff --git a/app/controllers/idv/welcome_controller.rb b/app/controllers/idv/welcome_controller.rb index 77e84bbb04d..ba1754d6b31 100644 --- a/app/controllers/idv/welcome_controller.rb +++ b/app/controllers/idv/welcome_controller.rb @@ -12,8 +12,7 @@ def show Funnel::DocAuth::RegisterStep.new(current_user.id, sp_session[:issuer]). call('welcome', :view, true) - @sp_name = decorated_sp_session.sp_name || APP_NAME - @title = t('doc_auth.headings.welcome', sp_name: @sp_name) + @presenter = Idv::WelcomePresenter.new(decorated_sp_session) end def update diff --git a/app/presenters/idv/welcome_presenter.rb b/app/presenters/idv/welcome_presenter.rb new file mode 100644 index 00000000000..6f938c937a5 --- /dev/null +++ b/app/presenters/idv/welcome_presenter.rb @@ -0,0 +1,82 @@ +module Idv + class WelcomePresenter + include ActionView::Helpers::TranslationHelper + include Rails.application.routes.url_helpers + include LinkHelper + include ActionView::Helpers::UrlHelper + + attr_accessor :url_options + + def initialize(decorated_sp_session) + @decorated_sp_session = decorated_sp_session + @url_options = {} + end + + def sp_name + decorated_sp_session.sp_name || APP_NAME + end + + def title + t('doc_auth.headings.welcome', sp_name: sp_name) + end + + def selfie_required? + decorated_sp_session.selfie_required? + end + + def explanation_text(help_link) + if selfie_required? + t( + 'doc_auth.info.stepping_up_html', + sp_name:, + link_html: help_link, + ) + else + t( + 'doc_auth.info.getting_started_html', + sp_name: sp_name, + link_html: help_link, + ) + end + end + + def bullet_points + [ + if selfie_required? + bullet_point( + t('doc_auth.instructions.bullet1_with_selfie'), + t('doc_auth.instructions.text1_with_selfie'), + ) + else + bullet_point( + t('doc_auth.instructions.bullet1'), + t('doc_auth.instructions.text1'), + ) + end, + + bullet_point( + t('doc_auth.instructions.bullet2'), + t('doc_auth.instructions.text2'), + ), + + bullet_point( + t('doc_auth.instructions.bullet3'), + t('doc_auth.instructions.text3'), + ), + + bullet_point( + t('doc_auth.instructions.bullet4', app_name: sp_name), + t('doc_auth.instructions.text4'), + ), + ] + end + + private + + attr_accessor :decorated_sp_session + + def bullet_point(bullet, text) + OpenStruct.new(bullet: bullet, text: text) + end + end +end diff --git a/app/views/idv/welcome/show.html.erb b/app/views/idv/welcome/show.html.erb index 0ce1009fd3c..950e6f58096 100644 --- a/app/views/idv/welcome/show.html.erb +++ b/app/views/idv/welcome/show.html.erb @@ -1,15 +1,13 @@ -<% self.title = @title %> +<% self.title = @presenter.title %> <%= render JavascriptRequiredComponent.new( header: t('idv.welcome.no_js_header'), - intro: t('idv.welcome.no_js_intro', sp_name: @sp_name), + intro: t('idv.welcome.no_js_intro', sp_name: @presenter.sp_name), location: :idv_welcome, ) do %> -<%= render PageHeadingComponent.new.with_content(@title) %> +<%= render PageHeadingComponent.new.with_content(@presenter.title) %>
- <%= t( - 'doc_auth.info.getting_started_html', - sp_name: @sp_name, - link_html: new_tab_link_to( + <%= @presenter.explanation_text( + new_tab_link_to( t('doc_auth.info.getting_started_learn_more'), help_center_redirect_path( category: 'verify-your-identity', @@ -25,31 +23,19 @@
<%= t('doc_auth.instructions.text1_with_selfie') %>
+ <% @presenter.bullet_points.each do |point| %> + <%= c.with_item(heading: point.bullet) do %> +<%= point.text %>
<% end %> - <% else %> - <%= c.with_item(heading: t('doc_auth.instructions.bullet1')) do %> -<%= t('doc_auth.instructions.text1') %>
- <% end %> - <% end %> - <%= c.with_item(heading: t('doc_auth.instructions.bullet2')) do %> -<%= t('doc_auth.instructions.text2') %>
- <% end %> - <%= c.with_item(heading: t('doc_auth.instructions.bullet3')) do %> -<%= t('doc_auth.instructions.text3') %>
- <% end %> - <%= c.with_item(heading: t('doc_auth.instructions.bullet4', app_name: APP_NAME)) do %> -<%= t('doc_auth.instructions.text4') %>
<% end %> <% end %> -<%= simple_form_for( - :doc_auth, - url: url_for, - method: 'put', - html: { autocomplete: 'off', class: 'margin-top-2 margin-bottom-5 js-consent-continue-form' }, - ) do |f| %> + + <%= simple_form_for( + :doc_auth, + url: url_for, + method: 'put', + html: { autocomplete: 'off', class: 'margin-top-2 margin-bottom-5 js-consent-continue-form' }, + ) do |f| %>