From 9e947a2c17a9b79b44b989a11da4c98e3539894f Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:48:14 +0000 Subject: [PATCH] Add component wrapper to feedback component --- CHANGELOG.md | 4 ++++ .../components/_feedback.html.erb | 11 +++++++---- .../components/docs/feedback.yml | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3d02db302..836c1a90e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ useful summary for people upgrading their application, not a replication of the commit log. +## Unreleased + +* Add component wrapper to feedback component ([PR #4351](https://github.com/alphagov/govuk_publishing_components/pull/4351)) + ## 44.9.1 * Layout super nav header: Correct name for search input ([PR #4347](https://github.com/alphagov/govuk_publishing_components/pull/4347)) diff --git a/app/views/govuk_publishing_components/components/_feedback.html.erb b/app/views/govuk_publishing_components/components/_feedback.html.erb index af3f0dee93..8371b93685 100644 --- a/app/views/govuk_publishing_components/components/_feedback.html.erb +++ b/app/views/govuk_publishing_components/components/_feedback.html.erb @@ -11,12 +11,15 @@ path_without_pii = utf_encode(request.fullpath.gsub(email_regex, '[email]')) disable_ga4 ||= false - data_module = "feedback" - data_module << " ga4-event-tracker" unless disable_ga4 + + component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) + component_helper.add_class("gem-c-feedback govuk-!-display-none-print") + component_helper.add_data_attribute({ module: "feedback" }) + component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless disable_ga4 %> -