Skip to content

Commit

Permalink
Move survey pages and urls in a yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinailie committed Oct 18, 2023
1 parent 9c30d45 commit a1dae6b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 50 deletions.
42 changes: 2 additions & 40 deletions app/presenters/content_item/recruitment_banner.rb
Original file line number Diff line number Diff line change
@@ -1,48 +1,10 @@
module ContentItem
module RecruitmentBanner
SURVEY_URL = "https://surveys.publishing.service.gov.uk/s/SNFVW1/".freeze
SURVEY_URL_MAPPINGS = {
"/log-in-register-hmrc-online-services" => SURVEY_URL,
"/log-in-file-self-assessment-tax-return" => SURVEY_URL,
"/self-assessment-tax-returns" => SURVEY_URL,
"/pay-self-assessment-tax-bill" => SURVEY_URL,
"/contact-hmrc" => SURVEY_URL,
"/log-in-register-hmrc-online-services/register" => SURVEY_URL,
"/dbs-update-service" => SURVEY_URL,
"/government/organisations/hm-revenue-customs/contact/self-assessment" => SURVEY_URL,
}.freeze

BENEFITS_SURVEY_URL = "https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16".freeze
BENEFITS_SURVEY_URL_MAPPINGS = {
"/disability-living-allowance-children" => BENEFITS_SURVEY_URL,
"/help-with-childcare-costs" => BENEFITS_SURVEY_URL,
"/financial-help-disabled" => BENEFITS_SURVEY_URL,
"/pip" => BENEFITS_SURVEY_URL,
"/blind-persons-allowance" => BENEFITS_SURVEY_URL,
"/dla-disability-living-allowance-benefit" => BENEFITS_SURVEY_URL,
"/carers-allowance" => BENEFITS_SURVEY_URL,
"/carers-credit" => BENEFITS_SURVEY_URL,
"/maternity-pay-leave" => BENEFITS_SURVEY_URL,
"/paternity-pay-leave" => BENEFITS_SURVEY_URL,
"/child-benefit" => BENEFITS_SURVEY_URL,
"/jobseekers-allowance" => BENEFITS_SURVEY_URL,
"/universal-credit" => BENEFITS_SURVEY_URL,
"/employment-support-allowance" => BENEFITS_SURVEY_URL,
"/benefits-calculators" => BENEFITS_SURVEY_URL,
}.freeze

def recruitment_survey_url
user_research_test_url
end

def benefits_recruitment_survey_url
pages = YAML.load_file(Rails.root.join("config/recruitment_banner_pages.yml"))
key = content_item["base_path"]
BENEFITS_SURVEY_URL_MAPPINGS[key]
end

def user_research_test_url
key = content_item["base_path"]
SURVEY_URL_MAPPINGS[key]
pages[key] if pages
end
end
end
11 changes: 1 addition & 10 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,11 @@
<% end %>

<% if @content_item.recruitment_survey_url %>
<div class="govuk-!-static-margin-top-4">
<%= render "govuk_publishing_components/components/intervention", {
suggestion_text: "Help improve a new GOV.UK tool",
suggestion_link_text: "Sign up to take part in user research",
suggestion_link_url: @content_item.recruitment_survey_url,
new_tab: true,
} %>
</div>
<% elsif @content_item.benefits_recruitment_survey_url %>
<div class="govuk-!-static-margin-top-4">
<%= render "govuk_publishing_components/components/intervention", {
suggestion_text: "Help improve GOV.UK",
suggestion_link_text: "Take part in user research",
suggestion_link_url: @content_item.benefits_recruitment_survey_url,
suggestion_link_url: @content_item.recruitment_survey_url,
new_tab: true,
} %>
</div>
Expand Down
28 changes: 28 additions & 0 deletions config/recruitment_banner_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Add bellow the pages we want to show a user research banner on and the survey link for each page
# eg. "/log-in-register-hmrc-online-services": "survey url"

"/log-in-register-hmrc-online-services": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/log-in-file-self-assessment-tax-return": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/self-assessment-tax-returns": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/pay-self-assessment-tax-bill": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/contact-hmrc": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/log-in-register-hmrc-online-services/register": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/dbs-update-service": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
"/government/organisations/hm-revenue-customs/contact/self-assessment": "https://surveys.publishing.service.gov.uk/s/SNFVW1/"

# Benefits pages
"/disability-living-allowance-children": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/help-with-childcare-costs": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/financial-help-disabled": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/pip": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/blind-persons-allowance": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/dla-disability-living-allowance-benefit": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/carers-allowance": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/carers-credit": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/maternity-pay-leave": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/paternity-pay-leave": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/child-benefit": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/jobseekers-allowance": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/universal-credit": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/employment-support-allowance": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16
"/benefits-calculators": https://signup.take-part-in-research.service.gov.uk/home?utm_campaign=Content_History&utm_source=Hold_gov_to_account&utm_medium=gov.uk&t=GDS&id=16

0 comments on commit a1dae6b

Please sign in to comment.