diff --git a/app/assets/stylesheets/components/publish/_cookie_banner.scss b/app/assets/stylesheets/components/publish/_cookie_banner.scss deleted file mode 100644 index 881a854628..0000000000 --- a/app/assets/stylesheets/components/publish/_cookie_banner.scss +++ /dev/null @@ -1,5 +0,0 @@ -.govuk-cookie-banner { - .decision { - display: inline; - } -} diff --git a/app/assets/stylesheets/publish_application.scss b/app/assets/stylesheets/publish_application.scss index 8f78269f62..e14d1b9bd9 100644 --- a/app/assets/stylesheets/publish_application.scss +++ b/app/assets/stylesheets/publish_application.scss @@ -11,9 +11,7 @@ @import "components/shared/phase-banner"; @import "components/shared/accordion"; - @import "components/publish/card"; -@import "components/publish/cookie_banner"; @import "components/publish/description-list"; @import "components/publish/inset-text"; @import "components/publish/link"; @@ -45,7 +43,9 @@ // This ensures govuk-button-to form wrapper is aligned within button groups properly .govuk-button-group { - form { display: contents; } + form { + display: contents; + } } .govuk-tag-no-max-width { diff --git a/app/controllers/cookie_preferences_controller.rb b/app/controllers/cookie_preferences_controller.rb index bb931bc93d..be6c3012c0 100644 --- a/app/controllers/cookie_preferences_controller.rb +++ b/app/controllers/cookie_preferences_controller.rb @@ -2,24 +2,4 @@ class CookiePreferencesController < ApplicationController skip_before_action :authenticate - - def show - @cookie_preferences_form = Publish::CookiePreferencesForm.new(cookies) - end - - def update - @cookie_preferences_form = Publish::CookiePreferencesForm.new(cookies, cookie_preferences_params) - - if @cookie_preferences_form.save - redirect_back(fallback_location: root_path, flash: { success: 'Your cookie preferences have been updated' }) - else - render(:show) - end - end - - private - - def cookie_preferences_params - params.require(:publish_cookie_preferences_form).permit(:analytics_consent) - end end diff --git a/app/controllers/find/cookie_preferences_controller.rb b/app/controllers/find/cookie_preferences_controller.rb index ae6ea8cd95..87fa7091d8 100644 --- a/app/controllers/find/cookie_preferences_controller.rb +++ b/app/controllers/find/cookie_preferences_controller.rb @@ -2,24 +2,5 @@ module Find class CookiePreferencesController < ApplicationController - def show - @cookie_preferences_form = CookiePreferencesForm.new(cookies) - end - - def update - @cookie_preferences_form = CookiePreferencesForm.new(cookies, cookie_preferences_params) - - if @cookie_preferences_form.save - redirect_back(fallback_location: root_path, flash: { success: I18n.t('cookies.preferences.success') }) - else - render(:show) - end - end - - private - - def cookie_preferences_params - params.require(:find_cookie_preferences_form).permit(:analytics_consent) - end end end diff --git a/app/forms/find/cookie_preferences_form.rb b/app/forms/find/cookie_preferences_form.rb deleted file mode 100644 index 2cc2f63ef6..0000000000 --- a/app/forms/find/cookie_preferences_form.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Find - class CookiePreferencesForm - include ActiveModel::Model - - ACCEPTED_VALUES = %w[granted denied].freeze - - attr_accessor :analytics_consent, :cookies, :analytics_cookie_name, :expiry_date - - validates :analytics_consent, presence: true, inclusion: { in: ACCEPTED_VALUES } - - def initialize(cookies, params = {}) - @cookies = cookies - @analytics_cookie_name = Settings.cookies.analytics.name - @expiry_date = Settings.cookies.expire_after_days.days.from_now - @analytics_consent = params[:analytics_consent] || cookies[analytics_cookie_name] - end - - def save - return unless valid? - - cookies[analytics_cookie_name] = { value: analytics_consent, expires: expiry_date } - end - end -end diff --git a/app/forms/publish/cookie_preferences_form.rb b/app/forms/publish/cookie_preferences_form.rb deleted file mode 100644 index 97c7db08ac..0000000000 --- a/app/forms/publish/cookie_preferences_form.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Publish - class CookiePreferencesForm - include ActiveModel::Model - - ACCEPTED_VALUES = %w[granted denied].freeze - - attr_accessor :analytics_consent, :cookies, :analytics_cookie_name, :expiry_date - - validates :analytics_consent, presence: true, inclusion: { in: ACCEPTED_VALUES } - - def initialize(cookies, params = {}) - @cookies = cookies - @analytics_cookie_name = Settings.cookies.analytics.name - @expiry_date = Settings.cookies.expire_after_days.days.from_now - @analytics_consent = params[:analytics_consent] || cookies[analytics_cookie_name] - end - - def save - return unless valid? - - cookies[analytics_cookie_name] = { value: analytics_consent, expires: expiry_date } - end - end -end diff --git a/app/helpers/cookies_helper.rb b/app/helpers/cookies_helper.rb deleted file mode 100644 index 8cb794ae8b..0000000000 --- a/app/helpers/cookies_helper.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module CookiesHelper - def consented_to_analytics_cookie_value - request.cookie_jar[Settings.cookies.analytics.name] - end - - def google_analytics_allowed? - consented_to_analytics_cookie_value == 'granted' - end - - def hide_cookie_banner? - consented_to_analytics_cookie_value =~ /granted|denied/ - end -end diff --git a/app/javascript/cookie_banner.js b/app/javascript/cookie_banner.js deleted file mode 100644 index f80b7b37b8..0000000000 --- a/app/javascript/cookie_banner.js +++ /dev/null @@ -1,83 +0,0 @@ -import { getCookie, setCookie } from './utils/cookie_helper' - -export default class CookieBanner { - static init () { - return new CookieBanner() - } - - constructor () { - if (this.isConsentAnswerRequired()) { - this.$banner = document.querySelector( - '[data-module="govuk-cookie-banner"]' - ) - - if (!this.$banner) return - - this.cookieName = - this.$banner.attributes['data-cookie-consent-name'].value - this.expiryAfterDays = - this.$banner.attributes['data-cookie-consent-expiry-after-days'].value - this.$afterConsentBanner = document.querySelector( - '[data-module="govuk-cookie-after-consent-banner"]' - ) - - this.$acceptButton = this.$banner.querySelector('[value="granted"]') - this.$rejectButton = this.$banner.querySelector('[value="denied"]') - this.$hideButton = this.$afterConsentBanner.querySelector('button') - - this.bindEvents() - } - } - - bindEvents () { - this.$acceptButton.addEventListener('click', () => this.accept()) - this.$rejectButton.addEventListener('click', () => this.reject()) - this.$hideButton.addEventListener('click', () => - this.hideAfterConsentBanner() - ) - } - - isConsentAnswerRequired () { - return getCookie(this.cookieName) === null - } - - saveAnswer (answer) { - setCookie(this.cookieName, answer, { days: this.expiryAfterDays }) - this.hideBanner() - this.$afterConsentBanner.querySelector('span').textContent = answer - this.showAfterConsentBanner() - } - - accept () { - this.saveAnswer(this.$acceptButton.value) - this.updateConsent() - } - - reject () { - this.saveAnswer(this.$rejectButton.value) - this.updateConsent() - } - - hideBanner () { - this.$banner.hidden = true - } - - showAfterConsentBanner () { - this.$afterConsentBanner.hidden = false - } - - hideAfterConsentBanner () { - this.$afterConsentBanner.hidden = true - } - - consent () { - return { - analytics_storage: getCookie(this.cookieName) || 'denied', - ad_storage: getCookie(this.cookieName) || 'denied' - } - } - - updateConsent () { - window.gtag('consent', 'update', this.consent()) - } -} diff --git a/app/javascript/cookie_banner.spec.js b/app/javascript/cookie_banner.spec.js deleted file mode 100644 index 47a0ffe646..0000000000 --- a/app/javascript/cookie_banner.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -import CookieBanner from './cookie_banner' - -const cookieName = '_consented_to_anaytics_cookies' - -const templateHTML = ` -
- - -
` - -describe('CookieBanner', () => { - beforeEach(() => { - document.body.innerHTML = templateHTML - }) - - describe('constructor', () => { - afterEach(() => { - jest.clearAllMocks() - }) - - it("doesn't run if cookie banner is not rendered by backend", () => { - document.body.innerHTML = '' - const banner = CookieBanner.init() - expect(banner.$banner).toBeNull() - }) - - describe('scenario where user has not given consent', () => { - beforeEach(() => { - jest - .spyOn(CookieBanner.prototype, 'isConsentAnswerRequired') - .mockImplementation(() => true) - }) - - describe('clicking accept', () => { - it("it stores the user's answer on the cookie and hides banner", () => { - const banner = CookieBanner.init() - banner.$acceptButton.click() - expect(document.cookie).toEqual(`${cookieName}=granted`) - expect(banner.$banner.hidden).toBeTruthy() - expect(banner.$afterConsentBanner.hidden).toBeFalsy() - }) - }) - - describe('clicking reject', () => { - it("it stores the user's answer on the cookie and hides banner", () => { - const banner = CookieBanner.init() - banner.$rejectButton.click() - expect(document.cookie).toEqual(`${cookieName}=denied`) - expect(banner.$banner.hidden).toBeTruthy() - expect(banner.$afterConsentBanner.hidden).toBeFalsy() - }) - }) - - describe('clicking hide message', () => { - it('it hides the after consent banner', () => { - const banner = CookieBanner.init() - banner.$hideButton.click() - expect(banner.$afterConsentBanner.hidden).toBeTruthy() - }) - }) - }) - }) -}) diff --git a/app/javascript/find/application.js b/app/javascript/find/application.js index f1dcfe2d23..f33592fd59 100644 --- a/app/javascript/find/application.js +++ b/app/javascript/find/application.js @@ -6,7 +6,6 @@ import { initAll } from 'govuk-frontend' import { FilterToggleButton } from './filter-toggle-button' import initAutocomplete from './autocomplete' import dfeAutocomplete from './dfe-autocomplete' -import CookieBanner from '../cookie_banner' import { Application } from '@hotwired/stimulus' import FilterSearchController from './controllers/filter_search_controller' @@ -21,8 +20,6 @@ initAll() dfeAutocomplete({ rawAttribute: false, confirmOnBlur: false }) -CookieBanner.init() - initAutocomplete({ element: 'location-autocomplete', input: 'location', diff --git a/app/javascript/jestGlobalMocks.js b/app/javascript/jestGlobalMocks.js deleted file mode 100644 index 8c6684e351..0000000000 --- a/app/javascript/jestGlobalMocks.js +++ /dev/null @@ -1,10 +0,0 @@ -/** ********************************* - * BROWSER MOCKS - ********************************** */ - -Object.defineProperty(window, 'dataLayer', { value: [] }) -Object.defineProperty(window, 'gtag', { - value: () => { - window.dataLayer.push(arguments) - } -}) diff --git a/app/javascript/publish/application.js b/app/javascript/publish/application.js index c28b5db38e..9da1054a28 100644 --- a/app/javascript/publish/application.js +++ b/app/javascript/publish/application.js @@ -7,7 +7,6 @@ import { initAll } from 'govuk-frontend' import autocompleteSetup from './autocomplete' import initLocationsMap from './locations-map' import FilterToggle from './filters' -import CookieBanner from '../cookie_banner' window.jQuery = jQuery window.$ = jQuery @@ -15,6 +14,5 @@ window.initLocationsMap = initLocationsMap initAll() FilterToggle.init() -CookieBanner.init() autocompleteSetup() diff --git a/app/javascript/utils/cookie_helper.js b/app/javascript/utils/cookie_helper.js deleted file mode 100644 index c7ef2718b5..0000000000 --- a/app/javascript/utils/cookie_helper.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @private - * @summary Fetches and returns a cookie by cookie name - * @param {string} name - Cookie name which the method should lookup - * @returns {string} Cookie string in key=value format - * @returns {null} if Cookie is not found - */ -function getCookie (name) { - const nameEQ = name + '=' - const cookies = document.cookie.split(';') - for (let i = 0, len = cookies.length; i < len; i++) { - let cookie = cookies[i] - while (cookie.charAt(0) === ' ') { - cookie = cookie.substring(1, cookie.length) - } - if (cookie.indexOf(nameEQ) === 0) { - return decodeURIComponent(cookie.substring(nameEQ.length)) - } - } - return null -} - -/** - * @private - * @summary Sets a cookie - * @param {string} name - Cookie name - * @param {string} value - Value the cookie will be set to - * @param {object} options - used to set cookie options like secure/ expiry date etc - * @example chocolateChip cookie value is tasty and expires in 2 days time - * setCookie('chocolateChip', 'Tasty', {days: 2 }) - * @example Delete/Expire existing chocolateChip cookie - * setCookie('chocolateChip', '', {days: -1 }) - */ -function setCookie (name, value, options) { - if (typeof options === 'undefined') { - options = {} - } - let cookieString = name + '=' + value + '; path=/' - if (options.days) { - const date = new Date() - date.setTime(date.getTime() + options.days * 24 * 60 * 60 * 1000) - cookieString = cookieString + '; expires=' + date.toGMTString() - } - if (document.location.protocol === 'https:') { - cookieString = cookieString + '; Secure' - } - document.cookie = cookieString -} - -export { getCookie, setCookie } diff --git a/app/views/cookie_preferences/show.html.erb b/app/views/cookie_preferences/show.html.erb index 0f4f741481..11d7b6a831 100644 --- a/app/views/cookie_preferences/show.html.erb +++ b/app/views/cookie_preferences/show.html.erb @@ -1,91 +1,35 @@ -<% content_for :page_title, title_with_error_prefix("Cookies", @cookie_preferences_form.errors.present?) %> +<% content_for :page_title, "Cookies" %>
- <%= form_with model: @cookie_preferences_form, url: cookies_path, method: :put do |f| %> +

Cookies on <%= t("service_name.publish") %>

- <%= f.govuk_error_summary %> +

Cookies are small files saved on your phone, tablet or computer when you visit a website.

-

Cookies on <%= t("service_name.publish") %>

+

We use cookies to make <%= t("service_name.publish") %> (Publish) work and collect information about how you use our service.

-

Cookies are small files saved on your phone, tablet or computer when you visit a website.

+

Essential cookies

-

We use cookies to make <%= t("service_name.publish") %> (Publish) work and collect information about how you use our service.

+

Essential cookies keep your information secure while you use Publish. We do not need to ask permission to use them.

-

Essential cookies

+ + + + + + + + -

Essential cookies keep your information secure while you use Publish. We do not need to ask permission to use them.

+ + + + + + + +
NamePurposeExpires
<%= Settings.cookies.session.name %>Stores encrypted session dataWhen you close your browser
- - - - - - - - - - - - - - - - - - - - -
NamePurposeExpires
<%= Settings.cookies.session.name %>Stores encrypted session dataWhen you close your browser
<%= Settings.cookies.analytics.name %>Saves your cookie consent settings6 months
- -

Cookies that measure website use (analytics)

- -

With your permission, we use Google Analytics to collect data about how you use Publish. This information helps us improve our service.

- -

Google is not allowed to use or share our analytics data with anyone.

- -

Google Analytics stores anonymised information about:

- - - - - - - - - - - - - - - - - - - - - - - -
NamePurposeExpires
_gaDistinguishes anonymous users2 years
_gidDistinguishes anonymous users24 hours
- - <%= f.govuk_collection_radio_buttons :analytics_consent, - [%w[granted Yes], %w[denied No]], - :first, - :last, - inline: true, - legend: { text: "Do you want to accept cookies that measure website use (analytics)?", size: "s" } %> - - <%= f.govuk_submit("Save cookie settings") %> - -

Read more about who we are, how you can contact us and how we process personal data in our <%= govuk_link_to("privacy notice", find_privacy_path) %>.

- -

You can also <%= govuk_link_to("find out more about cookies in Google’s Privacy and Terms", t("google_privacy_policy_url"), target: "_blank") %>.

- <% end %> +

Read more about who we are, how you can contact us and how we process personal data in our <%= govuk_link_to("privacy notice", find_privacy_path) %>.

diff --git a/app/views/find/cookie_preferences/show.html.erb b/app/views/find/cookie_preferences/show.html.erb index 84df8b853f..de298d4ed2 100644 --- a/app/views/find/cookie_preferences/show.html.erb +++ b/app/views/find/cookie_preferences/show.html.erb @@ -1,106 +1,35 @@ -<% content_for :page_title, title_with_error_prefix("Cookies", @cookie_preferences_form.errors.present?) %> +<% content_for :page_title, "Cookies" %>
- <%= form_with model: @cookie_preferences_form, url: find_cookies_path, method: :put do |f| %> +

Cookies on <%= t("service_name.find") %>

- <%= f.govuk_error_summary %> +

Cookies are small files saved on your phone, tablet or computer when you visit a website.

-

Cookies on <%= t("service_name.find") %>

+

We use cookies to make <%= t("service_name.find") %> (Find) work and collect information about how you use our service.

-

Cookies are small files saved on your phone, tablet or computer when you visit a website.

+

Essential cookies

-

We use cookies to make <%= t("service_name.find") %> (Find) work and collect information about how you use our service.

+

Essential cookies keep your information secure while you use Find. We do not need to ask permission to use them.

-

Essential cookies

+ + + + + + + + -

Essential cookies keep your information secure while you use Find. We do not need to ask permission to use them.

+ + + + + + + +
NamePurposeExpires
<%= Settings.cookies.session.name %>Stores encrypted session dataWhen you close your browser
- - - - - - - - - - - - - - - - - - - - -
NamePurposeExpires
<%= Settings.cookies.session.name %>Stores encrypted session dataWhen you close your browser
<%= Settings.cookies.analytics.name %>Saves your cookie consent settings6 months
- -

Cookies that measure website use (analytics)

- -

With your permission, we use Google Analytics to collect data about how you use Find. This information helps us improve our service.

- -

Google is not allowed to use or share our analytics data with anyone.

- -

Google Analytics stores anonymised information about:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NamePurposeExpires
_gaDistinguishes anonymous users2 years
_gidDistinguishes anonymous users24 hours
_gatLimits requests10 minutes
_gcl_aw, _gcl_dc & _gcl_auUsed to distinguish anonymous users90 days
IDE, ANID, DSID, FLC, AID, TAID & exchange_uidUsed to distinguish which adverts Find users have seen and clicked on13 months
- - <%= f.govuk_collection_radio_buttons :analytics_consent, - [%w[granted Yes], %w[denied No]], - :first, - :last, - inline: true, - legend: { text: "Do you want to accept cookies that measure website use (analytics)?", size: "s" } %> - - <%= f.govuk_submit("Save cookie settings", data: { qa: "save-changes" }) %> - -

Read more about who we are, how you can contact us and how we process personal data in our <%= govuk_link_to("privacy notice", find_privacy_path) %>.

- -

You can also <%= govuk_link_to("find out more about cookies in Google’s Privacy and Terms", t("google_privacy_policy_url"), target: "_blank") %>.

- <% end %> +

Read more about who we are, how you can contact us and how we process personal data in our <%= govuk_link_to("privacy notice", find_privacy_path) %>.

diff --git a/app/views/layouts/_cookie_banner.html.erb b/app/views/layouts/_cookie_banner.html.erb deleted file mode 100644 index c301e51fc3..0000000000 --- a/app/views/layouts/_cookie_banner.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<%= render GovukComponent::CookieBannerComponent.new( - html_attributes: { - "data-module" => "govuk-cookie-banner", - "data-cookie-consent-name" => Settings.cookies.analytics.name, - "data-cookie-consent-expiry-after-days" => Settings.cookies.expire_after_days, - "data-qa" => "cookie-banner", - "nosnippet" => true - } -) do |cookie_banner| %> - <%= cookie_banner.with_message(heading_text: t("cookies.heading", service_name:), - text: t("cookies.message_html")) do |message| %> - <% message.with_action do %> - - - <%= govuk_link_to(t("cookies.cookies_page_link"), cookies_path) %> - <% end %> - <% end %> -<% end %> -<%= render GovukComponent::CookieBannerComponent.new(html_attributes: { - "hidden" => true, - "data-module" => "govuk-cookie-after-consent-banner" -}) do |cookie_banner| %> - <% cookie_preferences_link = govuk_link_to(t("cookies.after_consent.page_link_text"), cookies_path) %> - <%= cookie_banner.with_message(text: t("cookies.after_consent.message", - cookie_preferences_link:).html_safe) do |message| %> - <% message.with_action do %> - - <% end %> - <% end %> -<% end %> diff --git a/app/views/layouts/_gtm.html.erb b/app/views/layouts/_gtm.html.erb deleted file mode 100644 index 256d238f2d..0000000000 --- a/app/views/layouts/_gtm.html.erb +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 819eefe1c3..ac826147f5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -26,21 +26,11 @@ <%= stylesheet_link_tag "accessible-autocomplete.min" %> <%= stylesheet_link_tag "publish_application" %> <%= javascript_include_tag "publish/application", "data-turbo-track": "reload", defer: true %> - - <%= render("layouts/gtm", tracking_id: Settings.google_tag_manager.publish_tracking_id, consented_to_analytics_cookie_value:) %> - <% if google_analytics_allowed? %> - - <% end %> - <%= render "layouts/add_js_enabled_class_to_body" %> - <% unless hide_cookie_banner? %> - <%= render("layouts/cookie_banner", service_name: t("service_name.publish"), cookies_path:) %> - <% end %> - <%= govuk_skip_link %> <% if content_for?(:header) %> diff --git a/app/views/layouts/find_layout.html.erb b/app/views/layouts/find_layout.html.erb index 655a500f36..820cb57c11 100644 --- a/app/views/layouts/find_layout.html.erb +++ b/app/views/layouts/find_layout.html.erb @@ -25,21 +25,11 @@ <%= stylesheet_link_tag "find_application" %> <%= javascript_include_tag "find/application", "data-turbo-track": "reload", defer: true %> - - <%= render("layouts/gtm", tracking_id: Settings.google_tag_manager.find_tracking_id, consented_to_analytics_cookie_value:) %> <%= render "layouts/add_js_enabled_class_to_body" %> - <% if google_analytics_allowed? %> - - <% end %> - - <% unless hide_cookie_banner? %> - <%= render("layouts/cookie_banner", service_name: t("service_name.find"), cookies_path: find_cookies_path) %> - <% end %> - <%= render Find::Header::View.new( service_name: t("service_name.find") ) %> diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 5a73a684b1..af559a70e8 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -20,30 +20,21 @@ policy.font_src :self, :data, *all_domains policy.img_src :self, :https, - :data, - "https://#{Settings.google_tag_manager.floodlight_id}.fls.doubleclick.net" # Floodlight + :data policy.object_src :none policy.script_src :self, - 'https://www.google-analytics.com', - 'https://www.googletagmanager.com', "'sha256-aBGeCwtg0DKytYpKh9kIMvmYL0sooy9+McqPAZ5feTk='", # add_js_enabled_class_to_body.html.erb *all_domains policy.connect_src :self, - 'https://stats.g.doubleclick.net', - 'https://googleads.g.doubleclick.net', 'https://*.sentry.io', - 'https://*.google-analytics.com', - 'https://*.analytics.google.com', 'https://www.google.com', *all_domains policy.style_src :self, *all_domains policy.frame_src :self, - 'https://www.googletagmanager.com', - "https://#{Settings.google_tag_manager.floodlight_id}.fls.doubleclick.net", # Floodlight *local_domains # Specify URI for violation reports diff --git a/config/locales/en.yml b/config/locales/en.yml index 6c2b28e624..5a32244531 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1219,10 +1219,6 @@ en: email: blank: "Enter an email adddress" invalid: "Enter a valid email address" - publish/cookie_preferences_form: - attributes: - analytics_consent: - blank: Select yes if you want to accept Google Analytics cookies publish/schools/search_form: attributes: query: @@ -1259,10 +1255,6 @@ en: environment: blank: Enter the environment to proceed invalid_environment: "That's not %{environment}" - find/cookie_preferences_form: - attributes: - analytics_consent: - blank: Select yes if you want to accept Google Analytics cookies errors: messages: email: "^Enter an email address in the correct format, like name@example.com" diff --git a/config/locales/find.yml b/config/locales/find.yml index b3d6f9eda8..dbbeceb0e6 100644 --- a/config/locales/find.yml +++ b/config/locales/find.yml @@ -233,8 +233,7 @@ en: international_candidates: skilled_worker_visa: not_available: - html: -

If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

+ html:

If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

available: html:

If you do not already have the right to work in the UK, you may need to apply for your visa to train to teach in England.

@@ -242,21 +241,19 @@ en:

Before you apply for this course, contact the training provider to check Skilled Worker visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.

student_visa: not_available: - html: -

If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

+ html:

If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

available: html:

If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

To do this, you’ll need to be sponsored by your training provider.

Before you apply for this course, contact the training provider to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.

entitlement: - html: -

You may be entitled to £10,000 from the UK government to help with the financial costs of moving to England.

+ html:

You may be entitled to £10,000 from the UK government to help with the financial costs of moving to England.

get_into_teaching: apply_for_statement_of_comparability: Apply for a statement of comparability chat_online: You can chat online support_team: with the Get Into Teaching support team for guidance on the UK equivalents of your qualifications. - qualifications_outside_uk: 'Non-UK citizens: check your qualifications' + qualifications_outside_uk: "Non-UK citizens: check your qualifications" qualifications_outside_uk_body: Some training providers need a certificate known as a statement of comparability that shows how your qualifications compare to UK ones. apply_for_uk_enic_html: You can apply for a statement of comparability from UK ENIC (the UK European Network of Information Centres). uk_enic_cost: There is a cost for the certificate and it takes 15 working days to arrive. @@ -300,8 +297,8 @@ en: result_filters_filters_view: radius_options_for_select: label: - one: '%{count} mile' - other: '%{count} miles' + one: "%{count} mile" + other: "%{count} miles" v2: results: index: @@ -363,7 +360,3 @@ en: subjects: primary_subject: "Select at least one primary subject you want to teach" secondary_subject: "Select at least one secondary subject you want to teach" - find/cookie_preferences_form: - attributes: - consent: - blank: Select yes if you want to accept Google Analytics cookies diff --git a/config/settings.yml b/config/settings.yml index 31d3e79920..c9bcca3df7 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -93,13 +93,5 @@ features: cookies: session: name: _teacher_training_courses_session - analytics: - name: _consented_to_anaytics_cookies - expire_after_days: 182 - -google_tag_manager: - find_tracking_id: change_me - publish_tracking_id: change_me - floodlight_id: 2673654 STATE_CHANGE_SLACK_URL: replace_me diff --git a/config/settings/production.yml b/config/settings/production.yml index 87394450d5..6f83b45888 100644 --- a/config/settings/production.yml +++ b/config/settings/production.yml @@ -30,10 +30,6 @@ environment: name: "beta" render_json_errors: true -google_tag_manager: - find_tracking_id: GTM-TP73392 - publish_tracking_id: GTM-W56GPKW - features: send_request_data_to_bigquery: true diff --git a/jest.config.js b/jest.config.js index 7ffd97e7ae..b4c598c7fc 100644 --- a/jest.config.js +++ b/jest.config.js @@ -15,7 +15,6 @@ module.exports = { '!/app/javascript/utils/test.js' ], reporters: ['default'], - setupFilesAfterEnv: ['/app/javascript/jestGlobalMocks.js'], transformIgnorePatterns: ['node_modules/*'], moduleNameMapper: { '^@/(.*)$': '/app/javascript/$1' diff --git a/package.json b/package.json index 627e38a947..7d349ec0fa 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,6 @@ "$", "google", "Stimulus" - ], - "ignore": [ - "app/javascript/jestGlobalMocks.js" ] }, "dependencies": { diff --git a/spec/features/find/cookie_banner_spec.rb b/spec/features/find/cookie_banner_spec.rb deleted file mode 100644 index f1acfead8a..0000000000 --- a/spec/features/find/cookie_banner_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -feature 'cookie banner' do - before do - find_results_page.load - end - - it 'renders a visible js fallback banner' do - expect(page).to have_text('We use some essential cookies to make this service work.') - end - - it 'renders a cookie banner' do - expect(page).to have_button('Accept analytics cookies') - expect(page).to have_button('Reject analytics cookies') - expect(page).to have_link('View cookies') - end - - it 'renders a hidden hide message banner' do - expect(page).to have_button('Hide this cookies', visible: :hidden) - end -end diff --git a/spec/features/find/cookie_preferences_spec.rb b/spec/features/find/cookie_preferences_spec.rb deleted file mode 100644 index 73384673b4..0000000000 --- a/spec/features/find/cookie_preferences_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -feature 'Updating cookie preferences' do - before do - Timecop.travel(Find::CycleTimetable.mid_cycle) - end - - scenario 'i can update my cookie preferences' do - given_i_am_on_the_find_cookie_preferences_page - and_i_can_see_the_heading - and_i_can_see_the_the_use_of_cookies_for_service - when_i_give_consent_and_submit - then_i_should_see_a_confirmation_message - end - - scenario 'i cannot update without selecting a preference' do - given_i_am_on_the_find_cookie_preferences_page - when_i_submit - then_i_should_see_an_error_message - end - - def given_i_am_on_the_find_cookie_preferences_page - find_cookie_preferences_page.load - end - - def when_i_give_consent_and_submit - find_cookie_preferences_page.analytics_cookie_accept.choose - when_i_submit - end - - def then_i_should_see_a_confirmation_message - expect(find_cookie_preferences_page).to have_content('Your cookie preferences have been updated') - end - - def when_i_submit - find_cookie_preferences_page.submit.click - end - - def then_i_should_see_an_error_message - expect(find_cookie_preferences_page.error_messages).to include( - 'Select yes if you want to accept Google Analytics cookies' - ) - end - - def and_i_can_see_the_heading - expect(find_cookie_preferences_page.heading).to have_content('Cookies') - end - - def and_i_can_see_the_the_use_of_cookies_for_service - expect(find_cookie_preferences_page).to have_content("We use cookies to make #{I18n.t('service_name.find')} (Find) work and collect information about how you use our service.") - end - - def find_cookie_preferences_page - @find_cookie_preferences_page ||= PageObjects::Find::CookiePreferences.new - end -end diff --git a/spec/features/publish/cookie_preferences_spec.rb b/spec/features/publish/cookie_preferences_spec.rb deleted file mode 100644 index f14a63343f..0000000000 --- a/spec/features/publish/cookie_preferences_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -feature 'Updating cookie preferences' do - scenario 'i can update my cookie preferences' do - given_i_am_on_the_publish_cookie_preferences_page - and_i_can_see_the_heading - and_i_can_see_the_the_use_of_cookies_for_service - when_i_give_consent_and_submit - then_i_should_see_a_confirmation_message - end - - scenario 'i cannot update without selecting a preference' do - given_i_am_on_the_publish_cookie_preferences_page - when_i_submit - then_i_should_see_an_error_message - end - - def given_i_am_on_the_publish_cookie_preferences_page - publish_cookie_preferences_page.load - end - - def when_i_give_consent_and_submit - publish_cookie_preferences_page.analytics_cookie_accept.choose - when_i_submit - end - - def then_i_should_see_a_confirmation_message - expect(publish_cookie_preferences_page).to have_content('Your cookie preferences have been updated') - end - - def when_i_submit - publish_cookie_preferences_page.submit.click - end - - def then_i_should_see_an_error_message - expect(publish_cookie_preferences_page.error_messages).to include( - 'Select yes if you want to accept Google Analytics cookies' - ) - end - - def and_i_can_see_the_heading - expect(publish_cookie_preferences_page.heading).to have_content('Cookies') - end - - def and_i_can_see_the_the_use_of_cookies_for_service - expect(publish_cookie_preferences_page).to have_content("We use cookies to make #{I18n.t('service_name.publish')} (Publish) work and collect information about how you use our service.") - end -end diff --git a/spec/support/page_objects/find/cookie_preferences.rb b/spec/support/page_objects/find/cookie_preferences.rb deleted file mode 100644 index 70632b473c..0000000000 --- a/spec/support/page_objects/find/cookie_preferences.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require_relative '../sections/error_link' - -module PageObjects - module Find - class CookiePreferences < PageObjects::Base - set_url '/cookies' - - element :heading, 'h1' - - element :analytics_cookie_accept, '#find-cookie-preferences-form-analytics-consent-granted-field' - element :analytics_cookie_deny, '#find-cookie-preferences-form-analytics-consent-denied-field' - - element :submit, 'button.govuk-button[type="submit"]' - - sections :errors, PageObjects::Sections::ErrorLink, '.govuk-error-summary__list li>a' - - def error_messages - errors.map(&:text) - end - end - end -end diff --git a/spec/support/page_objects/publish/cookie_preferences.rb b/spec/support/page_objects/publish/cookie_preferences.rb deleted file mode 100644 index 80eda24dc4..0000000000 --- a/spec/support/page_objects/publish/cookie_preferences.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require_relative '../sections/error_link' - -module PageObjects - module Publish - class CookiePreferences < PageObjects::Base - set_url '/cookies' - - element :heading, 'h1' - - element :analytics_cookie_accept, '#publish-cookie-preferences-form-analytics-consent-granted-field' - element :analytics_cookie_deny, '#publish-cookie-preferences-form-analytics-consent-denied-field' - - element :submit, 'button.govuk-button[type="submit"]' - - sections :errors, PageObjects::Sections::ErrorLink, '.govuk-error-summary__list li>a' - - def error_messages - errors.map(&:text) - end - end - end -end