diff --git a/app/controllers/assisted_digital_feedback_controller.rb b/app/controllers/assisted_digital_feedback_controller.rb index 555a68402..cc47fbe01 100644 --- a/app/controllers/assisted_digital_feedback_controller.rb +++ b/app/controllers/assisted_digital_feedback_controller.rb @@ -48,7 +48,7 @@ def create private - helper_method :show_survey? + helper_method :show_survey?, :promotion def set_locale helpers.set_locale @@ -74,6 +74,10 @@ def show_survey? LEGACY_SLUGS.exclude?(params[:slug]) end + def promotion + @publication.promotion + end + def set_form_field_values # Set form values so that responses are not lost when the form reloads due to errors if params["service_feedback"].presence diff --git a/app/controllers/service_feedback_controller.rb b/app/controllers/service_feedback_controller.rb index 35c000ed1..06446666e 100644 --- a/app/controllers/service_feedback_controller.rb +++ b/app/controllers/service_feedback_controller.rb @@ -8,6 +8,33 @@ class ServiceFeedbackController < ContactController "done/driving-transaction-finished", ].freeze + # The Photo ID promo should only appear on these pages. This has been + # hardcoded as it is a short campaign and will be removed manually when + # the campaign has ended. + PHOTO_ID_PROMO_SLUGS = %w[ + done/find-pension-contact-details + done/lost-stolen-passport + done/use-lasting-power-of-attorney + done/vehicle-operator-licensing + done/apply-first-provisional-driving-licence + done/apply-blue-badge + done/get-state-pension + done/check-driving-licence + done/blue-badge + done/renew-medical-driving-licence + done/apply-driver-digital-tachograph-card + done/prove-right-to-work + done/report-driving-medical-condition + done/brp-not-arrived + done/send-prisoner-money + done/brp-report-lost-stolen + done/brp-collection-problem + done/view-prove-your-rights-uk + done/brp-report-problem + done/find-driving-schools-and-lessons + done/register-to-vot + ].freeze + layout "service_feedback" before_action :set_locale, if: -> { request.format.html? } @@ -52,7 +79,7 @@ def create private - helper_method :show_survey? + helper_method :show_survey?, :promotion def set_locale helpers.set_locale @@ -74,6 +101,16 @@ def show_survey? LEGACY_SLUGS.exclude?(params[:slug]) end + def promotion + @publication.promotion || photo_id_promotion + end + + # To copy the same structure that a promo would appear in the + # content item, means we don't need to modify any other code. + def photo_id_promotion + { 'category': "photo_id", 'url': "/how-to-vote/photo-id-youll-need" }.with_indifferent_access if PHOTO_ID_PROMO_SLUGS.include?(params[:slug]) + end + def set_form_field_values # Set form values so that responses are not lost when the form reloads due to errors if params["service_feedback"].presence diff --git a/app/views/shared/_completed_transaction_feedback.html.erb b/app/views/shared/_completed_transaction_feedback.html.erb index 7c6fa269f..81f3fc95b 100644 --- a/app/views/shared/_completed_transaction_feedback.html.erb +++ b/app/views/shared/_completed_transaction_feedback.html.erb @@ -7,50 +7,8 @@ <% unless show_survey? %>

<%= t("controllers.contact.govuk.service_feedback.thanks_for_visiting") %>

<% end %> - <% if publication.promotion %> -
- <% if publication.promotion["category"] == "organ_donor" %> - <%= render "govuk_publishing_components/components/heading", { - text: t("controllers.contact.govuk.service_feedback.organ_donation"), - font_size: "s", - margin_bottom: 3 - } %> - -

- <%= t("controllers.contact.govuk.service_feedback.tell_family_organ_donation") %> -

- -

- <%= link_to t("controllers.contact.govuk.service_feedback.register_to_donate"), publication.promotion["url"], { class: "govuk-link" } %> -

- <% elsif publication.promotion["category"] == "mot_reminder" %> - <%= render "govuk_publishing_components/components/heading", { - text: t("controllers.contact.govuk.service_feedback.mot_promotion"), - font_size: "s", - margin_bottom: 3 - } %> - -

- <%= t("controllers.contact.govuk.service_feedback.mot_reminder") %> -

- -

- <%= link_to t("controllers.contact.govuk.service_feedback.get_mot_reminders"), publication.promotion["url"], { class: "govuk-link" } %> -

- <% elsif publication.promotion["category"] == "electric_vehicle" %> - <%= render "govuk_publishing_components/components/heading", { - text: t("controllers.contact.govuk.service_feedback.electric_car_promotion"), - font_size: "s", - margin_bottom: 3 - } %> - -

<%= t("controllers.contact.govuk.service_feedback.switch_to_electric_vehicle") %>

- -

- <%= link_to t("controllers.contact.govuk.service_feedback.make_next_car_electric"), publication.promotion["url"], { class: "govuk-link" } %> -

- <% end %> -
+ <% if promotion %> + <%= render "shared/promo", t("controllers.contact.govuk.service_feedback.#{promotion['category']}").merge({ link_href: promotion['url'] }) %>
<% end %> <% if show_survey? %> diff --git a/app/views/shared/_promo.html.erb b/app/views/shared/_promo.html.erb new file mode 100644 index 000000000..7a54405c0 --- /dev/null +++ b/app/views/shared/_promo.html.erb @@ -0,0 +1,15 @@ +
+ <%= render "govuk_publishing_components/components/heading", { + text: title, + font_size: "s", + margin_bottom: 3 + } %> + +

+ <%= description %> +

+ +

+ <%= link_to link_text, link_href, { class: "govuk-link" } %> +

+
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 6e97e3ff1..95e7f5ab1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -85,23 +85,31 @@ en: very_dissatisfied: Very dissatisfied yes: Yes service_feedback: - electric_car_promotion: Electric car promotion + electric_vehicle: + title: Electric car promotion + description: Find out how much money you can save on fuel by switching to an electric vehicle. + link_text: Make your next car electric + mot_reminder: + title: MOT promotion + description: Get a text or email reminder when your MOT is due. + link_text: Get MOT reminders + organ_donor: + title: Organ donation + description: Tell your family about your organ donation decision. + link_text: Register a decision to donate + photo_id: + title: Bring photo ID to vote + description: From 4 May 2023 you’ll need to show photo ID when you vote in person in some UK elections or referendums. + link_text: Check which photo ID you’ll need to vote error_messages: There is a problem dissatisfied: Dissatisfied - get_mot_reminders: Get MOT reminders how_improve: How could we improve this service? heading: Satisfaction survey - make_next_car_electric: Make your next car electric - mot_reminder: Get a text or email reminder when your MOT is due. - mot_promotion: MOT promotion no_pii_hint: Do not include any personal or financial information, for example your National Insurance or credit card numbers. neither: Neither satisfied or dissatisfied - organ_donation: Organ donation - register_to_donate: Register a decision to donate satisfied: Satisfied send_feedback: Send feedback service_satisfaction_rating: Overall, how did you feel about the service you received today? - switch_to_electric_vehicle: Find out how much money you can save on fuel by switching to an electric vehicle. tell_family_organ_donation: Tell your family about your organ donation decision thanks_for_visiting: Thanks for visiting GOV.UK. very_dissatisfied: Very dissatisfied