diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 81fa46257..f6ca70e0e 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -22,6 +22,7 @@ $govuk-new-link-styles: true; @import "govuk_publishing_components/components/govspeak-html-publication"; @import "govuk_publishing_components/components/image-card"; @import "govuk_publishing_components/components/inset-text"; +@import "govuk_publishing_components/components/intervention"; @import "govuk_publishing_components/components/inverse-header"; @import "govuk_publishing_components/components/lead-paragraph"; @import "govuk_publishing_components/components/metadata"; diff --git a/app/assets/stylesheets/components/_banner.scss b/app/assets/stylesheets/components/_banner.scss index 55c773b78..5349b2e4c 100644 --- a/app/assets/stylesheets/components/_banner.scss +++ b/app/assets/stylesheets/components/_banner.scss @@ -34,3 +34,7 @@ max-width: 30em; padding-top: govuk-spacing(2); } + +.gem-c-intervention { + margin-top: govuk-spacing(4); +} diff --git a/app/presenters/content_item/recruitment_banner.rb b/app/presenters/content_item/recruitment_banner.rb new file mode 100644 index 000000000..b40912fc1 --- /dev/null +++ b/app/presenters/content_item/recruitment_banner.rb @@ -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 diff --git a/app/presenters/content_item_presenter.rb b/app/presenters/content_item_presenter.rb index fd2a68232..9e21ffce6 100644 --- a/app/presenters/content_item_presenter.rb +++ b/app/presenters/content_item_presenter.rb @@ -2,6 +2,7 @@ class ContentItemPresenter include ContentItem::Withdrawable include ContentItem::BrexitTaxons include ContentItem::SinglePageNotificationButton + include ContentItem::RecruitmentBanner attr_reader :content_item, :requested_path, :view_context, diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6f206e855..4760fc59a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -31,7 +31,14 @@