Browse Source

CLDC-3089 Make absolute skip/back links relative (#2348)

* Empty-Commit

* feat: make skip links relative

* feat: make scheme back links relative

* feat: update tests
pull/2383/head
natdeanlewissoftwire 8 months ago committed by GitHub
parent
commit
a0215d45ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/models/form/lettings/pages/uprn.rb
  2. 2
      app/models/form/lettings/pages/uprn_selection.rb
  3. 4
      app/models/form/sales/pages/uprn.rb
  4. 2
      app/models/form/sales/pages/uprn_selection.rb
  5. 2
      app/views/schemes/confirm_secondary.html.erb
  6. 2
      app/views/schemes/secondary_client_group.html.erb
  7. 2
      app/views/schemes/support.html.erb
  8. 2
      spec/models/form/lettings/pages/uprn_selection_spec.rb
  9. 4
      spec/models/form/lettings/pages/uprn_spec.rb
  10. 2
      spec/models/form/sales/pages/uprn_selection_spec.rb
  11. 4
      spec/models/form/sales/pages/uprn_spec.rb

4
app/models/form/lettings/pages/uprn.rb

@ -24,9 +24,9 @@ class Form::Lettings::Pages::Uprn < ::Form::Page
return unless log return unless log
if form.start_year_after_2024? if form.start_year_after_2024?
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address-matcher" "address-matcher"
else else
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address" "address"
end end
end end
end end

2
app/models/form/lettings/pages/uprn_selection.rb

@ -27,6 +27,6 @@ class Form::Lettings::Pages::UprnSelection < ::Form::Page
def skip_href(log = nil) def skip_href(log = nil)
return unless log return unless log
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address-matcher" "address-matcher"
end end
end end

4
app/models/form/sales/pages/uprn.rb

@ -23,9 +23,9 @@ class Form::Sales::Pages::Uprn < ::Form::Page
return unless log return unless log
if form.start_year_after_2024? if form.start_year_after_2024?
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address-matcher" "address-matcher"
else else
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address" "address"
end end
end end
end end

2
app/models/form/sales/pages/uprn_selection.rb

@ -27,6 +27,6 @@ class Form::Sales::Pages::UprnSelection < ::Form::Page
def skip_href(log = nil) def skip_href(log = nil)
return unless log return unless log
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address-matcher" "address-matcher"
end end
end end

2
app/views/schemes/confirm_secondary.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
href: request.query_parameters["check_answers"] ? "/schemes/#{@scheme.id}/check-answers" : "/schemes/#{@scheme.id}/primary-client-group", href: request.query_parameters["check_answers"] ? "check-answers" : "primary-client-group",
) %> ) %>
<% end %> <% end %>

2
app/views/schemes/secondary_client_group.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
href: request.query_parameters["check_answers"] ? "/schemes/#{@scheme.id}/check-answers" : "/schemes/#{@scheme.id}/confirm-secondary-client-group", href: request.query_parameters["check_answers"] ? "check-answers" : "confirm-secondary-client-group",
) %> ) %>
<% end %> <% end %>

2
app/views/schemes/support.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
href: request.query_parameters["check_answers"] ? "/schemes/#{@scheme.id}/check-answers" : "/schemes/#{@scheme.id}/secondary-client-group", href: request.query_parameters["check_answers"] ? "check-answers" : "secondary-client-group",
) %> ) %>
<% end %> <% end %>

2
spec/models/form/lettings/pages/uprn_selection_spec.rb

@ -34,7 +34,7 @@ RSpec.describe Form::Lettings::Pages::UprnSelection, type: :model do
it "has the correct skip_href" do it "has the correct skip_href" do
expect(page.skip_href(log)).to eq( expect(page.skip_href(log)).to eq(
"/lettings-logs/#{log.id}/address-matcher", "address-matcher",
) )
end end

4
spec/models/form/lettings/pages/uprn_spec.rb

@ -50,7 +50,7 @@ RSpec.describe Form::Lettings::Pages::Uprn, type: :model do
context "with 2023/24 form" do context "with 2023/24 form" do
it "points to address page" do it "points to address page" do
expect(page.skip_href(log)).to eq( expect(page.skip_href(log)).to eq(
"/lettings-logs/#{log.id}/address", "address",
) )
end end
@ -66,7 +66,7 @@ RSpec.describe Form::Lettings::Pages::Uprn, type: :model do
it "points to address search page" do it "points to address search page" do
expect(page.skip_href(log)).to eq( expect(page.skip_href(log)).to eq(
"/lettings-logs/#{log.id}/address-matcher", "address-matcher",
) )
end end

2
spec/models/form/sales/pages/uprn_selection_spec.rb

@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Pages::UprnSelection, type: :model do
it "has the correct skip_href" do it "has the correct skip_href" do
expect(page.skip_href(log)).to eq( expect(page.skip_href(log)).to eq(
"/sales-logs/#{log.id}/address-matcher", "address-matcher",
) )
end end

4
spec/models/form/sales/pages/uprn_spec.rb

@ -50,7 +50,7 @@ RSpec.describe Form::Sales::Pages::Uprn, type: :model do
context "with 2023/24 form" do context "with 2023/24 form" do
it "points to address page" do it "points to address page" do
expect(page.skip_href(log)).to eq( expect(page.skip_href(log)).to eq(
"/sales-logs/#{log.id}/address", "address",
) )
end end
@ -66,7 +66,7 @@ RSpec.describe Form::Sales::Pages::Uprn, type: :model do
it "points to address search page" do it "points to address search page" do
expect(page.skip_href(log)).to eq( expect(page.skip_href(log)).to eq(
"/sales-logs/#{log.id}/address-matcher", "address-matcher",
) )
end end

Loading…
Cancel
Save