Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move survey pages and urls in a yml file #2962

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 5 additions & 41 deletions app/presenters/content_item/recruitment_banner.rb
Original file line number Diff line number Diff line change
@@ -1,48 +1,12 @@
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
def recruitment_survey_details
survey_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]
# TODO: check if all the values are in place
# TODO: if the text is not specified in the yml, we should use the standard one
survey_pages.find{ |banner| banner["pages"].include?(key) } if survey_pages

Check failure on line 9 in app/presenters/content_item/recruitment_banner.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
end
end
end
17 changes: 4 additions & 13 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,12 @@
<% end %>
<% end %>

<% if @content_item.recruitment_survey_url %>
<% if @content_item.recruitment_survey_details %>
<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_text: @content_item.recruitment_survey_details["suggestion_text"],
suggestion_link_text: @content_item.recruitment_survey_details["suggestion_link_text"],
suggestion_link_url: @content_item.recruitment_survey_details["suggestion_link_url"],
new_tab: true,
} %>
</div>
Expand Down
38 changes: 38 additions & 0 deletions config/recruitment_banner_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Add bellow the pages we want to show a user research banner on and the survey link for each page

-
name: Benefits banner
suggestion_text: "Help improve GOV.UK"
suggestion_link_text: "Take part in user research"
suggestion_link_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"
pages:
- "/disability-living-allowance-children"
- "/help-with-childcare-costs"
- "/financial-help-disabled"
- "/pip"
- "/blind-persons-allowance"
- "/dla-disability-living-allowance-benefit"
- "/carers-allowance"
- "/carers-credit"
- "/maternity-pay-leave"
- "/paternity-pay-leave"
- "/child-benefit"
- "/jobseekers-allowance"
- "/universal-credit"
- "/employment-support-allowance"
- "/benefits-calculators"

-
name: Research banner
suggestion_text: "Help improve a new GOV.UK tool"
suggestion_link_text: "Sign up to take part in user research"
suggestion_link_url: "https://surveys.publishing.service.gov.uk/s/SNFVW1/"
pages:
- "/log-in-register-hmrc-online-services"
- "/log-in-file-self-assessment-tax-return"
- "/self-assessment-tax-returns"
- "/pay-self-assessment-tax-bill"
- "/contact-hmrc"
- "/log-in-register-hmrc-online-services/register"
- "/dbs-update-service"
- "/government/organisations/hm-revenue-customs/contact/self-assessment"