Skip to content

Commit

Permalink
[1996] - Create interstitial start page for withdrawals (#4850)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-a-v-e committed Dec 4, 2024
1 parent f9a347a commit c0a16bf
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/components/record_actions/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def course_started_but_no_specified_start_date?

def relevant_redirect_path
if trainee.trainee_start_date.present?
edit_trainee_withdrawal_date_path(trainee)
trainee_withdrawal_start_path(trainee)
else
trainee_start_date_verification_path(trainee, context: :withdraw)
end
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/trainees/withdrawal/starts_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Trainees
module Withdrawal
class StartsController < Base
def show
# No additional logic needed for now
end
end
end
end
29 changes: 29 additions & 0 deletions app/views/trainees/withdrawal/starts/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<%= render PageTitle::View.new(text: t("trainees.withdrawals.start.show.heading")) %>

<%= content_for(:breadcrumbs) do %>
<%= render GovukComponent::BackLinkComponent.new(
text: t("back"),
href: trainee_path(trainee),
) %>
<% end %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<span class="govuk-caption-l"><%= trainee.full_name %></span>
<h1 class="govuk-heading-l"><%= t("trainees.withdrawals.start.show.heading") %></h1>

<h2 class="govuk-heading-m"><%= t("trainees.withdrawals.start.show.before_you_start.header") %></h2>
<p class="govuk-body">
<%= t("trainees.withdrawals.start.show.before_you_start.body") %>
</p>

<h2 class="govuk-heading-m"><%= t("trainees.withdrawals.start.show.how_your_answers_will_help.header") %></h2>
<p class="govuk-body">
<%= t("trainees.withdrawals.start.show.how_your_answers_will_help.body") %>
</p>

<%= govuk_link_to t("views.forms.common.continue"), edit_trainee_withdrawal_date_path(trainee), class: "govuk-button" %>
</div>
</div>

<%= govuk_link_to t("views.forms.common.cancel_and_return_to_record"), trainee_path(trainee), class: "govuk-link app-button--link govuk-body", role: "link" %>
9 changes: 9 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,15 @@ en:
label: Which country or territory is the trainee studying in?
hint: If the trainee is studying in more than one country or territory, choose the one where they’ll spend the most time.
withdrawals:
start:
show:
heading: "Withdraw the trainee"
before_you_start:
header: "Before you start"
body: "Make sure you have all the background information to why this trainee has withdrawn."
how_your_answers_will_help:
header: "How your answers will help us"
body: "Your answers will help us better understand withdrawal reasons and inform policy with the aim to increase trainee retention."
dates:
edit:
heading: When did the trainee withdraw?
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
resource :award_recommendations, only: %i[create]

namespace :withdrawal do
resource :start, only: :show
resource :date, only: %i[edit update]
resource :reason, only: %i[edit update]
resource :extra_information, only: %i[edit update], path: "extra-information"
Expand Down
17 changes: 13 additions & 4 deletions spec/features/trainee_actions/withdraw_trainee_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
given_i_am_authenticated
given_a_trainee_exists_to_be_withdrawn_with_no_start_date
and_i_am_on_the_trainee_record_page
and_i_click_on_withdraw
and_i_click_on_withdraw_and_continue
and_i_choose_they_have_not_started
then_i_am_taken_to_the_forbidden_withdrawal_page
end
Expand Down Expand Up @@ -169,7 +169,7 @@
given_i_am_authenticated
given_a_deferred_trainee_exists
and_i_am_on_the_trainee_record_page
and_i_click_on_withdraw
and_i_click_on_withdraw_and_continue
then_the_deferral_text_should_be_shown
when_i_check_a_reason(withdrawal_reason.name)
and_i_continue(:reason)
Expand All @@ -185,7 +185,7 @@
given_a_trainee_exists_to_be_withdrawn
and_the_trainee_has_a_duplicate
and_i_am_on_the_trainee_record_page
and_i_click_on_withdraw
and_i_click_on_withdraw_and_continue
then_the_duplicate_record_text_should_be_shown
end

Expand Down Expand Up @@ -226,7 +226,7 @@ def when_i_am_on_the_withdrawal_page
given_i_am_authenticated
given_a_trainee_exists_to_be_withdrawn
and_i_am_on_the_trainee_record_page
and_i_click_on_withdraw
and_i_click_on_withdraw_and_continue
end

def when_i_am_on_the_date_page
Expand Down Expand Up @@ -283,10 +283,19 @@ def and_i_continue(page)
public_send("withdrawal_#{page}_page").continue.click
end

def and_i_click_on_withdraw_and_continue
and_i_click_on_withdraw
and_i_start_withdrawal
end

def and_i_click_on_withdraw
record_page.withdraw.click
end

def and_i_start_withdrawal
and_i_continue(:start)
end

def when_i_withdraw
withdrawal_confirmation_page.withdraw.click
end
Expand Down
4 changes: 4 additions & 0 deletions spec/support/features/page_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ def trainee_admin_page
@trainee_admin_page ||= PageObjects::Trainees::Admin.new
end

def withdrawal_start_page
@withdrawal_start_page ||= PageObjects::Trainees::Withdrawal::Start.new
end

def withdrawal_date_page
@withdrawal_date_page ||= PageObjects::Trainees::Withdrawal::Date.new
end
Expand Down
16 changes: 16 additions & 0 deletions spec/support/page_objects/trainees/withdrawal/start.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module PageObjects
module Trainees
module Withdrawal
class Start < PageObjects::Base
include PageObjects::Helpers

set_url "/trainees/{id}/withdrawal/start"

element :continue, ".govuk-button", text: "Continue"
element :cancel, "a", text: "Cancel and return to record"
end
end
end
end

0 comments on commit c0a16bf

Please sign in to comment.