-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UR recruitment banner to pages tagged to Working browse
The number of responses hasn't been as much as we hoped, so I'd like to put the banner out more widely. This adds the banner to all pages tagged to 'Working, jobs and pensions' mainstream browse. Excluding the mainstream browse page itself, as that's been looked at in the A/B test.
- Loading branch information
Showing
6 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,7 @@ | |
max-width: 30em; | ||
padding-top: govuk-spacing(2); | ||
} | ||
|
||
.gem-c-intervention { | ||
margin-top: govuk-spacing(4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module ContentItem | ||
module RecruitmentBanner | ||
SURVEY_URL_ONE = "https://GDSUserResearch.optimalworkshop.com/treejack/3z828uy6".freeze | ||
SURVEY_URLS = { | ||
"/browse/working" => SURVEY_URL_ONE, | ||
}.freeze | ||
|
||
def recruitment_survey_url | ||
key = SURVEY_URLS.keys.find { |k| content_tagged_to(k).present? } | ||
SURVEY_URLS[key] | ||
end | ||
|
||
private | ||
|
||
def mainstream_browse_pages | ||
content_item["links"]["mainstream_browse_pages"] if content_item["links"] | ||
end | ||
|
||
def content_tagged_to(browse_base_path) | ||
return [] unless mainstream_browse_pages | ||
|
||
mainstream_browse_pages.find do |mainstream_browse_page| | ||
mainstream_browse_page["base_path"].starts_with? browse_base_path | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require "test_helper" | ||
|
||
class RecruitmentBannerTest < ActionDispatch::IntegrationTest | ||
test "Recruitment Banner is displayed for any page tagged to Working, jobs and pensions" do | ||
@working_browse_page = { | ||
"content_id" => "123", | ||
"title" => "Self Assessment", | ||
"base_path" => "/browse/working/self-assessment", | ||
} | ||
|
||
guide = GovukSchemas::Example.find("guide", example_name: "guide") | ||
guide["links"]["mainstream_browse_pages"] = [] | ||
guide["links"]["mainstream_browse_pages"] << @working_browse_page | ||
|
||
stub_content_store_has_item(guide["base_path"], guide.to_json) | ||
visit guide["base_path"] | ||
|
||
assert page.has_css?(".gem-c-intervention") | ||
assert page.has_link?("Take part in user research (opens in a new tab)", href: "https://GDSUserResearch.optimalworkshop.com/treejack/3z828uy6") | ||
end | ||
|
||
test "Recruitment Banner is not displayed unless page is tagged to a topic of interest" do | ||
@not_of_interest = { | ||
"content_id" => "123", | ||
"title" => "I am not interesting", | ||
"base_path" => "/browse/boring", | ||
} | ||
|
||
guide = GovukSchemas::Example.find("guide", example_name: "guide") | ||
guide["links"]["mainstream_browse_pages"] = [] | ||
guide["links"]["mainstream_browse_pages"] << @not_of_interest | ||
stub_content_store_has_item(guide["base_path"], guide.to_json) | ||
visit_with_cachebust guide["base_path"] | ||
|
||
assert_not page.has_css?(".gem-c-intervention") | ||
assert_not page.has_link?("Take part in user research", href: "https://GDSUserResearch.optimalworkshop.com/treejack/3z828uy6") | ||
end | ||
end |