Skip to content

Commit

Permalink
Use govuk_link_to new_tab argument
Browse files Browse the repository at this point in the history
This automatically makes the link open in a new tab by setting the
correct HTML attributes.
  • Loading branch information
thomasleese committed Feb 27, 2024
1 parent ba785bc commit 2f576d9
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 30 deletions.
8 changes: 1 addition & 7 deletions app/helpers/upload_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

module UploadHelper
def upload_link_to(upload)
href =
govuk_link_to(
"#{upload.name} (opens in a new tab)",
upload_path(upload),
target: :_blank,
rel: :noopener,
)
href = govuk_link_to(upload.name, upload_path(upload), new_tab: true)

scan_result_problem =
malware_scanning_enabled? &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

<% if provider.check_url.present? %>
<p class="govuk-body">Check the applicant’s <%= provider.reference_name %> at:</p>
<p class="govuk-body"><%= govuk_link_to provider.check_url, provider.check_url, target: "_blank", rel: "noreferrer noopener" %></p>
<p class="govuk-body"><%= govuk_link_to provider.check_url, provider.check_url, new_tab: true %></p>
<% end %>
<% else %>
<p class="govuk-body">
Applicants from <%= CountryName.from_region(region, with_definite_article: true) %> can provide tests from a wider range of approved providers.
</p>

<p class="govuk-body">
<%= govuk_link_to "Approved providers", "https://register.ofqual.gov.uk/Search?category=Qualifications&query=ESOl", target: "_blank", rel: "noreferrer noopener" %>
<%= govuk_link_to "Approved providers", "https://register.ofqual.gov.uk/Search?category=Qualifications&query=ESOl", new_tab: true %>
</p>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<% if (online_checker_url = region.teaching_authority_online_checker_url).present? %>
<% accordion.with_section(heading_text: "Online checker") do %>
<p class="govuk-body">This authority has an online checker for validating the supplied registration number:</p>
<p class="govuk-body"><%= govuk_link_to online_checker_url, online_checker_url, target: "_blank", rel: "noreferrer noopener" %></p>
<p class="govuk-body"><%= govuk_link_to online_checker_url, online_checker_url, new_tab: true %></p>
<% end %>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_employment_warning.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= govuk_warning_text do %>
The Department for Education (DfE) does not employ teachers directly.
To find a teaching job, you must <%= govuk_link_to "apply to individual schools in England", "https://getintoteaching.education.gov.uk/non-uk-teachers/teach-in-england-if-you-trained-overseas/#find-a-teaching-job", target: "_blank", rel: "noreferrer noopener" %>.
To find a teaching job, you must <%= govuk_link_to "apply to individual schools in England", "https://getintoteaching.education.gov.uk/non-uk-teachers/teach-in-england-if-you-trained-overseas/#find-a-teaching-job", new_tab: true %>.
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<h3 class="govuk-heading-s">Finding a certified translator</h3>

<p class="govuk-body">
We cannot recommend translation providers. You can find a professional translator through the <%= govuk_link_to "Institute of Translating and Interpreting (ITI) (opens in new tab)", "https://www.iti.org.uk/component/itisearch/?view=translators", target: :_blank, rel: :noopener %>. All listed translators have been certified by the ITI and are qualified to complete translations.
We cannot recommend translation providers. You can find a professional translator through the <%= govuk_link_to "Institute of Translating and Interpreting (ITI) (opens in new tab)", "https://www.iti.org.uk/component/itisearch/?view=translators", new_tab: true %>. All listed translators have been certified by the ITI and are qualified to complete translations.
</p>

<p class="govuk-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<p class="govuk-body">You’ll need a Secure English Language Test (SELT) at level B2 from an approved provider.</p>
<% else %>
<p class="govuk-body">
If you cannot provide one of the documents described in 1,2 or 3, you'll need a <a href="https://www.coe.int/en/web/common-european-framework-reference-languages/table-1-cefr-3.3-common-reference-levels-global-scale" target="_blank">B2 level</a> Secure English Language Test (SELT) from on approved provider. We accept the following approved providers and tests:
If you cannot provide one of the documents described in 1,2 or 3, you'll need a <%= govuk_link_to "B2 level", "https://www.coe.int/en/web/common-european-framework-reference-languages/table-1-cefr-3.3-common-reference-levels-global-scale", new_tab: true %> Secure English Language Test (SELT) from on approved provider. We accept the following approved providers and tests:
</p>

<ul class="govuk-list govuk-list--bullet">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<% if @years_count == 0 && @months_count < 9 %>
<%= govuk_details(summary_text: "I do not have more than 9 months of teaching experience") do %>
<p class="govuk-body">QTS requires a minimum of 9 months of active teaching experience. We can keep your application open for 6 months, so you can continue later, if you gain enough experience in that time.</p>
<p class="govuk-body">Alternatively, you can <a href="https://getintoteaching.education.gov.uk/non-uk-teachers/teach-in-england-if-you-trained-overseas" class="govuk-link" rel="noreferrer noopener" target="_blank">explore other ways to teach in England (opens in new tab)</a>.</p>
<p class="govuk-body">Alternatively, you can <%= govuk_link_to "explore other ways to teach in England (opens in new tab)", "https://getintoteaching.education.gov.uk/non-uk-teachers/teach-in-england-if-you-trained-overseas", new_tab: true %>.</p>
<% end %>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

<h1 class="govuk-heading-l">Your work experience does not meet all of the requirements for QTS</h1>

<p class="govuk-body">You can <a href="https://getintoteaching.education.gov.uk/non-uk-teachers/teach-in-england-if-you-trained-overseas" class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener" target="_blank">explore other ways to teach in England (opens in new tab)</a>.</p>
<p class="govuk-body">
You can <%= govuk_link_to "explore other ways to teach in England (opens in new tab)", "https://getintoteaching.education.gov.uk/non-uk-teachers/teach-in-england-if-you-trained-overseas", new_tab: true %>.
</p>

<%= render "shared/help_us_to_improve_this_service" %>
6 changes: 3 additions & 3 deletions spec/components/check_your_answers_summary_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@

it "renders the value" do
expect(row.at_css(".govuk-summary-list__value a").text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)
expect(row.at_css(".govuk-summary-list__value a")[:href]).to eq(
"/teacher/application/documents/#{model.document.id}/uploads/#{model.document.uploads.last.id}",
Expand Down Expand Up @@ -330,7 +330,7 @@

it "renders the value" do
expect(row.at_css(".govuk-summary-list__value a").text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)

document = model.translatable_document
Expand Down Expand Up @@ -359,7 +359,7 @@

it "renders the value" do
expect(row.at_css(".govuk-summary-list__value a").text).to eq(
"translation_upload.pdf (opens in a new tab)",
"translation_upload.pdf (opens in new tab)",
)

document = model.translatable_document
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/upload_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

it "returns a link to the upload" do
expect(upload_link_to).to have_link(
"#{upload.name} (opens in a new tab)",
"#{upload.name} (opens in new tab)",
href:
"/teacher/application/documents/#{upload.document.id}/uploads/#{upload.id}",
)
Expand All @@ -24,7 +24,7 @@

it "returns a link to the upload" do
expect(upload_link_to).to have_link(
"#{upload.name} (opens in a new tab)",
"#{upload.name} (opens in new tab)",
href:
"/assessor/application/documents/#{upload.document.id}/uploads/#{upload.id}",
)
Expand Down
6 changes: 3 additions & 3 deletions spec/system/teacher_interface/documents_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ def then_i_see_the_check_your_uploaded_files_page
"Check your uploaded files – written statement document",
)
expect(teacher_check_uploaded_files_page.files).to have_content(
"File 1\tupload.pdf (opens in a new tab)\tDelete",
"File 1\tupload.pdf (opens in new tab)\tDelete",
)
expect(teacher_check_uploaded_files_page.files).to have_content(
"File 2\tupload.pdf (opens in a new tab)\tDelete",
"File 2\tupload.pdf (opens in new tab)\tDelete",
)
end

def then_i_see_the_check_your_uploaded_files_page_with_three_files
then_i_see_the_check_your_uploaded_files_page
expect(teacher_check_uploaded_files_page.files).to have_content(
"File 3\tupload.pdf (opens in a new tab)\tDelete",
"File 3\tupload.pdf (opens in new tab)\tDelete",
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/system/teacher_interface/english_language_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def and_i_see_the_my_medium_of_instruction
"Medium of instruction document",
)
expect(document_summary_list_row.value.text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)
end

Expand Down Expand Up @@ -375,7 +375,7 @@ def and_i_see_the_my_other_provider
"English language proficiency test document",
)
expect(reference_summary_list_row.value.text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/system/teacher_interface/malware_scanning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def then_i_see_the_check_your_uploaded_files_page

def and_the_uploaded_files_have_been_marked_as_malware
expect(teacher_check_uploaded_files_page.files).to have_content(
"File 1\tFile upload error (opens in a new tab)\nThere’s a problem with this file",
"File 1\tFile upload error (opens in new tab)\nThere’s a problem with this file",
)
expect(teacher_check_uploaded_files_page.files).to have_content(
"File 2\tFile upload error (opens in a new tab)\nThere’s a problem with this file",
"File 2\tFile upload error (opens in new tab)\nThere’s a problem with this file",
)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/system/teacher_interface/personal_information_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def and_i_see_the_check_page_with_an_alternative_name
teacher_check_personal_information_page.summary_list.rows[6]
expect(name_change_document_row.key.text).to eq("Name change document")
expect(name_change_document_row.value.text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/system/teacher_interface/qualifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ def and_i_see_the_qualification_information

expect(summary_list_rows[6].key.text).to eq("Certificate document")
expect(summary_list_rows[6].value.text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)

expect(summary_list_rows[7].key.text).to eq("Transcript document")
expect(summary_list_rows[7].value.text).to eq(
"upload.pdf (opens in a new tab)",
"upload.pdf (opens in new tab)",
)

expect(summary_list_rows[8].key.text).to eq(
Expand Down

0 comments on commit 2f576d9

Please sign in to comment.