govuk_publishing_components 34.8.1 → 34.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f532a98c6b1f7f829963c983606cac99ee9335f6000f35ec51f05741524e08d3
4
- data.tar.gz: 6243027ce6610b993099f6469809750945eeb78180f23eec7952a58fa1809150
3
+ metadata.gz: b6da9ed1af8922136300b056ca61432de28330b478e25e23334917d0fdec9041
4
+ data.tar.gz: 2efcf7e5c91aaca82158059670b6b5ea7d4f52cb998b49a23e13deb32276958e
5
5
  SHA512:
6
- metadata.gz: 12a54683c41202563b1d1558c0abdb2c32218505289a14a83744dc3ea630d518e012dbd67c8c787b6a5d24f75e1514e31c745c8195bce3d4d8a933493c671061
7
- data.tar.gz: ecc1b37817bd4c0f897811d56ec853c1a84f28c9a6ac24bc9e466c17f8a2d9061ed572050aefe5dc48e33c498b4cb571d424c081896e178e45b74d71b77a6ed9
6
+ metadata.gz: c5b8de64f9ba866ce83e1ef48be8d42f3f57b74891f446cba362c83e1a4be599d67039fc9f4cd9ee2e3b77345a4fb2955310a2aefb45b9bfcdf59e69bc06fdd3
7
+ data.tar.gz: 75251f6417ec2c5e3e542eab3f2a914b93c9a5153f6b3be40848640d1e4944d2186e169a26198760cac76f482667e1d73e743105504c465b31974c583b4a0f3f
@@ -9,8 +9,12 @@
9
9
  <svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z"/></svg><span class="gem-c-single-page-notication-button__text"><%= component_helper.button_text %></span>
10
10
  <% end %>
11
11
  <%= tag.div class: wrapper_classes, data: { module: "gem-track-click"} do %>
12
- <%= tag.form class: component_helper.classes, action: "/email/subscriptions/single-page/new", method: "POST", data: component_helper.data do %>
12
+ <%= tag.form class: component_helper.classes, action: component_helper.form_action, method: "POST", data: component_helper.data do %>
13
13
  <input type="hidden" name="base_path" value="<%= component_helper.base_path %>">
14
+ <% if component_helper.skip_account %>
15
+ <input type="hidden" name="<%= component_helper.skip_account_param %>" value="true">
16
+ <input type="hidden" name="link" value="<%= component_helper.base_path %>">
17
+ <% end %>
14
18
  <%= content_tag(:button, button_text, {
15
19
  class: "govuk-body-s gem-c-single-page-notification-button__submit",
16
20
  type: "submit",
@@ -57,3 +57,9 @@ examples:
57
57
  button_text:
58
58
  subscribe: 'Subscribe to this page of things'
59
59
  unsubscribe: 'Unsubscribe to this page of things'
60
+ with_skip_account:
61
+ description: If the skip_account flag is present, the button action will be set to the non GOV.UK account signup endpoint of /email-signup.
62
+ data:
63
+ base_path: '/current-page-path'
64
+ js_enhancement: true
65
+ skip_account: true
@@ -1,7 +1,7 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class SinglePageNotificationButtonHelper
4
- attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location, :classes
4
+ attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location, :classes, :skip_account
5
5
 
6
6
  def initialize(local_assigns)
7
7
  @local_assigns = local_assigns
@@ -15,6 +15,7 @@ module GovukPublishingComponents
15
15
  @classes << "js-personalisation-enhancement" if js_enhancement
16
16
  @button_text_subscribe = custom_button_text_is_valid? ? custom_subscribe_text : default_subscribe_text
17
17
  @button_text_unsubscribe = custom_button_text_is_valid? ? custom_unsubscribe_text : default_unsubscribe_text
18
+ @skip_account = @local_assigns[:skip_account] || nil
18
19
  end
19
20
 
20
21
  def data
@@ -58,6 +59,22 @@ module GovukPublishingComponents
58
59
  def default_unsubscribe_text
59
60
  I18n.t("components.single_page_notification_button.unsubscribe_text")
60
61
  end
62
+
63
+ def form_action
64
+ @skip_account ? email_alert_frontend_endpoint_no_account : email_alert_frontend_endpoint_enforce_account
65
+ end
66
+
67
+ def email_alert_frontend_endpoint_enforce_account
68
+ "/email/subscriptions/single-page/new"
69
+ end
70
+
71
+ def email_alert_frontend_endpoint_no_account
72
+ "/email-signup"
73
+ end
74
+
75
+ def skip_account_param
76
+ "single_page_subscription"
77
+ end
61
78
  end
62
79
  end
63
80
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "34.8.1".freeze
2
+ VERSION = "34.9.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 34.8.1
4
+ version: 34.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev