diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 408a74b21..44440e945 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -3,7 +3,6 @@ //= require govuk_publishing_components/components/error-summary //= require govuk_publishing_components/components/govspeak //= require govuk_publishing_components/components/image-card -//= require govuk_publishing_components/components/intervention //= require govuk_publishing_components/components/metadata //= require govuk_publishing_components/components/print-link //= require govuk_publishing_components/components/radio diff --git a/app/helpers/recruitment_banner_helper.rb b/app/helpers/recruitment_banner_helper.rb deleted file mode 100644 index c7eb0f3e9..000000000 --- a/app/helpers/recruitment_banner_helper.rb +++ /dev/null @@ -1,27 +0,0 @@ -module RecruitmentBannerHelper - def recruitment_banner - return false if recruitment_banners.nil? - - current_path = request.path - - recruitment_banners.find do |banner| - next unless valid?(banner) - - banner["page_paths"]&.include?(current_path) - end - end - - def recruitment_banners - recruitment_banners_urls_file_path = Rails.root.join("lib/data/recruitment_banners.yml") - recruitment_banners_data = YAML.load_file(recruitment_banners_urls_file_path) - recruitment_banners_data["banners"] - end - - def valid?(banner) - required_fields.select { |field| banner[field].present? } == required_fields - end - - def required_fields - %w[survey_url suggestion_text suggestion_link_text page_paths] - end -end diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index 9c81cf657..1f66c3cce 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -3,8 +3,6 @@ schema: :faq ) %> <% end %> -<%= render 'shared/intervention_banner' %> - <%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.title_and_context[:title] } %>
diff --git a/app/views/content_items/document_collection.html.erb b/app/views/content_items/document_collection.html.erb index 97f92a238..3424ba746 100644 --- a/app/views/content_items/document_collection.html.erb +++ b/app/views/content_items/document_collection.html.erb @@ -3,7 +3,6 @@ schema: :article ) %> <% end %> -<%= render 'shared/intervention_banner' %>
<%= render 'govuk_publishing_components/components/title', diff --git a/app/views/shared/_intervention_banner.html.erb b/app/views/shared/_intervention_banner.html.erb deleted file mode 100644 index cbbbcc02f..000000000 --- a/app/views/shared/_intervention_banner.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% if recruitment_banner.present? %> -
- <%= render "govuk_publishing_components/components/intervention", { - new_tab: true, - suggestion_text: recruitment_banner["suggestion_text"], - suggestion_link_text: recruitment_banner["suggestion_link_text"], - suggestion_link_url: recruitment_banner["survey_url"], - } %> -
-<% end %> diff --git a/lib/data/recruitment_banners.yml b/lib/data/recruitment_banners.yml deleted file mode 100644 index 32c4121eb..000000000 --- a/lib/data/recruitment_banners.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Example usage of adding a banner to the banners list: - - # - name: Banner 1 - # suggestion_text: "Help improve GOV.UK" - # suggestion_link_text: "Sign up to take part in user research (opens in a new tab)" - # survey_url: https://google.com - # page_paths: - # - / - # - /foreign-travel-advice - -banners: -- name: HMRC banner 21/10/2024 - suggestion_text: "Help improve GOV.UK" - suggestion_link_text: "Sign up to take part in user research (opens in a new tab)" - survey_url: https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_74GjifgnGv6GsMC?Source=BannerList_HMRC_PAS_TAD - page_paths: - - /guidance/keeping-your-hmrc-login-details-safe - - /government/collections/hmrc-phishing-and-scams-detailed-information diff --git a/test/integration/recruitment_banner_test.rb b/test/integration/recruitment_banner_test.rb deleted file mode 100644 index 86cf5ac48..000000000 --- a/test/integration/recruitment_banner_test.rb +++ /dev/null @@ -1,34 +0,0 @@ -require "test_helper" - -class RecruitmentBannerTest < ActionDispatch::IntegrationTest - test "HMRC banner 21/10/2024 is displayed on detailed guide of interest" do - detailed_guide = GovukSchemas::Example.find("detailed_guide", example_name: "detailed_guide") - - detailed_guide["base_path"] = "/guidance/keeping-your-hmrc-login-details-safe" - stub_content_store_has_item(detailed_guide["base_path"], detailed_guide.to_json) - visit detailed_guide["base_path"] - - assert page.has_css?(".gem-c-intervention") - assert page.has_link?("Sign up to take part in user research (opens in a new tab)", href: "https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_74GjifgnGv6GsMC?Source=BannerList_HMRC_PAS_TAD") - end - - test "HMRC banner 21/10/2024 is displayed on document collection of interest" do - document_collection = GovukSchemas::Example.find("document_collection", example_name: "document_collection") - - document_collection["base_path"] = "/government/collections/hmrc-phishing-and-scams-detailed-information" - stub_content_store_has_item(document_collection["base_path"], document_collection.to_json) - visit document_collection["base_path"] - - assert page.has_css?(".gem-c-intervention") - assert page.has_link?("Sign up to take part in user research (opens in a new tab)", href: "https://survey.take-part-in-research.service.gov.uk/jfe/form/SV_74GjifgnGv6GsMC?Source=BannerList_HMRC_PAS_TAD") - end - - test "HMRC banner 21/10/2024 is not displayed on all pages" do - detailed_guide = GovukSchemas::Example.find("detailed_guide", example_name: "detailed_guide") - detailed_guide["base_path"] = "/nothing-to-see-here" - stub_content_store_has_item(detailed_guide["base_path"], detailed_guide.to_json) - visit detailed_guide["base_path"] - - assert_not page.has_css?(".gem-c-intervention") - end -end diff --git a/test/unit/helpers/recruitment_banner_helper_test.rb b/test/unit/helpers/recruitment_banner_helper_test.rb deleted file mode 100644 index 3c261853f..000000000 --- a/test/unit/helpers/recruitment_banner_helper_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require "test_helper" - -class RecruitmentBannerHelperTest < ActionView::TestCase - include RecruitmentBannerHelper - - def setup - @recruitment_banners_data = YAML.load_file(Rails.root.join("test/fixtures/recruitment_banners.yml")) - end - - def request - OpenStruct.new(path: "/") - end - - def recruitment_banners - @recruitment_banners_data["banners"] - end - - test "recruitment_banner returns banners that include the current url" do - actual_banners = recruitment_banner - - expected_banners = - { - "name" => "Banner 1", - "suggestion_text" => "Help improve GOV.UK", - "suggestion_link_text" => "Take part in user research", - "survey_url" => "https://google.com", - "page_paths" => ["/"], - } - assert_equal expected_banners, actual_banners - end - - test "recruitment_banners yaml structure is valid" do - @recruitment_banners_data = YAML.load_file(Rails.root.join("lib/data/recruitment_banners.yml")) - - if @recruitment_banners_data["banners"].present? - recruitment_banners.each do |banner| - assert banner.key?("suggestion_text"), "Banner is missing 'suggestion_text' key" - assert_not banner["suggestion_text"].blank?, "'suggestion_text' key should not be blank" - - assert banner.key?("suggestion_link_text"), "Banner is missing 'suggestion_link_text' key" - assert_not banner["suggestion_link_text"].blank?, "'suggestion_link_text' key should not be blank" - - assert banner.key?("survey_url"), "Banner is missing 'survey_url' key" - assert_not banner["survey_url"].blank?, "'survey_url' key should not be blank" - - assert banner.key?("page_paths"), "Banner is missing 'page_paths' key" - assert_not banner["page_paths"].blank?, "'page_paths' key should not be blank" - end - end - end -end