Skip to content

Commit

Permalink
WIP update promo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosa-Fox committed Feb 27, 2023
1 parent 8c61ef5 commit 9cab730
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 54 deletions.
6 changes: 5 additions & 1 deletion app/controllers/assisted_digital_feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create

private

helper_method :show_survey?
helper_method :show_survey?, :promotion

def set_locale
helpers.set_locale
Expand All @@ -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
Expand Down
39 changes: 38 additions & 1 deletion app/controllers/service_feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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? }
Expand Down Expand Up @@ -52,7 +79,7 @@ def create

private

helper_method :show_survey?
helper_method :show_survey?, :promotion

def set_locale
helpers.set_locale
Expand All @@ -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
Expand Down
46 changes: 2 additions & 44 deletions app/views/shared/_completed_transaction_feedback.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,8 @@
<% unless show_survey? %>
<p class="govuk-body"><%= t("controllers.contact.govuk.service_feedback.thanks_for_visiting") %></p>
<% end %>
<% if publication.promotion %>
<div class="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
} %>

<p class="govuk-body">
<%= t("controllers.contact.govuk.service_feedback.tell_family_organ_donation") %>
</p>

<p class="govuk-body govuk-!-margin-bottom-0">
<%= link_to t("controllers.contact.govuk.service_feedback.register_to_donate"), publication.promotion["url"], { class: "govuk-link" } %>
</p>
<% 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
} %>

<p class="govuk-body">
<%= t("controllers.contact.govuk.service_feedback.mot_reminder") %>
</p>

<p class="govuk-body govuk-!-margin-bottom-0">
<%= link_to t("controllers.contact.govuk.service_feedback.get_mot_reminders"), publication.promotion["url"], { class: "govuk-link" } %>
</p>
<% 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
} %>

<p class="govuk-body"><%= t("controllers.contact.govuk.service_feedback.switch_to_electric_vehicle") %></p>

<p class="govuk-body govuk-!-margin-bottom-0">
<%= link_to t("controllers.contact.govuk.service_feedback.make_next_car_electric"), publication.promotion["url"], { class: "govuk-link" } %>
</p>
<% end %>
</div>
<% if promotion %>
<%= render "shared/promo", t("controllers.contact.govuk.service_feedback.#{promotion['category']}").merge({ link_href: promotion['url'] }) %>
<hr class="govuk-section-break govuk-section-break--l">
<% end %>
<% if show_survey? %>
Expand Down
15 changes: 15 additions & 0 deletions app/views/shared/_promo.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="promotion">
<%= render "govuk_publishing_components/components/heading", {
text: title,
font_size: "s",
margin_bottom: 3
} %>

<p class="govuk-body">
<%= description %>
</p>

<p class="govuk-body govuk-!-margin-bottom-0">
<%= link_to link_text, link_href, { class: "govuk-link" } %>
</p>
</div>
24 changes: 16 additions & 8 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9cab730

Please sign in to comment.