Skip to content

Commit

Permalink
Rename route_owner to route_page
Browse files Browse the repository at this point in the history
  • Loading branch information
lfdebrux committed Feb 25, 2025
1 parent 2c3ce94 commit 24cd6e7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ def delete
if @page.routing_conditions.any? && @page.routing_conditions.first.secondary_skip?
@routing = :start_of_secondary_skip_route

# route owner is condition check page
@route_owner = PageRepository.find(page_id: @page.routing_conditions.first.check_page_id, form_id: current_form.id)
# route page is condition check page
@route_page = PageRepository.find(page_id: @page.routing_conditions.first.check_page_id, form_id: current_form.id)
elsif @page.routing_conditions.any?
@routing = :start_of_route

# route owner is us
@route_owner = @page
# route page is us
@route_page = @page
elsif @page_goto_conditions.any? && @page_goto_conditions.first.secondary_skip?
@routing = :end_of_secondary_skip_route

# route owner is condition check page
@route_owner = PageRepository.find(page_id: @page_goto_conditions.first.check_page_id, form_id: current_form.id)
# route page is condition check page
@route_page = PageRepository.find(page_id: @page_goto_conditions.first.check_page_id, form_id: current_form.id)
elsif @page_goto_conditions.any?
@routing = :end_of_route

# route owner is condition routing page
@route_owner = PageRepository.find(page_id: @page_goto_conditions.first.routing_page_id, form_id: current_form.id)
# route page is condition routing page
@route_page = PageRepository.find(page_id: @page_goto_conditions.first.routing_page_id, form_id: current_form.id)
end

@delete_confirmation_input = Forms::DeleteConfirmationInput.new
Expand Down
4 changes: 2 additions & 2 deletions app/views/pages/delete.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

t(
".notification_banner.#{@routing}.html",
route_owner_position: @route_owner.position,
show_routes_href: show_routes_path(current_form.id, @route_owner.id),
route_page_position: @route_page.position,
show_routes_href: show_routes_path(current_form.id, @route_page.id),
)
end %>
<% end %>
Expand Down
10 changes: 5 additions & 5 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1153,28 +1153,28 @@ en:
heading_text: Question %{page_position} is at the end of a route
html: |
<p class="govuk-body">
<a class="govuk-notification-banner__link" href="%{show_routes_href}">Question %{route_owner_position}’s route</a>
goes to this question. If you delete this question, question %{route_owner_position}’s routes will also be deleted.
<a class="govuk-notification-banner__link" href="%{show_routes_href}">Question %{route_page_position}’s route</a>
goes to this question. If you delete this question, question %{route_page_position}’s routes will also be deleted.
</p>
end_of_secondary_skip_route:
heading_text: Question %{page_position} is at the end of a route
html: |
<p class="govuk-body">
<a class="govuk-notification-banner__link" href="%{show_routes_href}">Question %{route_owner_position}’s route</a>
<a class="govuk-notification-banner__link" href="%{show_routes_href}">Question %{route_page_position}’s route</a>
goes to this question. If you delete this question, the route to it will also be deleted.
</p>
start_of_route:
heading_text: Question %{page_position} is the start of a route
html: |
<p class="govuk-body">
If you delete this question, its routes will also be deleted.
<a class="govuk-notification-banner__link" href="%{show_routes_href}">View question %{route_owner_position}’s routes</a>.
<a class="govuk-notification-banner__link" href="%{show_routes_href}">View question %{route_page_position}’s routes</a>.
</p>
start_of_secondary_skip_route:
heading_text: Question %{page_position} is the start of a route
html: |
<p class="govuk-body">
<a class="govuk-notification-banner__link" href="%{show_routes_href}">Question %{route_owner_position}’s route</a>
<a class="govuk-notification-banner__link" href="%{show_routes_href}">Question %{route_page_position}’s route</a>
starts at this question. If you delete this question, the route from it will also be deleted.
</p>
title: Are you sure you want to delete this question?
Expand Down
8 changes: 4 additions & 4 deletions spec/views/pages/delete.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

before do
assign(:routing, :start_of_route)
assign(:route_owner, page)
assign(:route_page, page)

render locals: { current_form: }
end
Expand Down Expand Up @@ -122,7 +122,7 @@

before do
assign(:routing, :end_of_route)
assign(:route_owner, routing_page)
assign(:route_page, routing_page)

assign(:page_goto_conditions, routing_page.routing_conditions)

Expand Down Expand Up @@ -182,7 +182,7 @@

before do
assign(:routing, :start_of_secondary_skip_route)
assign(:route_owner, check_page)
assign(:route_page, check_page)

render locals: { current_form: }
end
Expand Down Expand Up @@ -250,7 +250,7 @@
before do
assign(:page_goto_conditions, routing_page.routing_conditions)
assign(:routing, :end_of_secondary_skip_route)
assign(:route_owner, check_page)
assign(:route_page, check_page)

render locals: { current_form: }
end
Expand Down

0 comments on commit 24cd6e7

Please sign in to comment.