govuk_publishing_components 34.8.1 → 34.9.1

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: 3f8b043d1285aa3d0477957b2472686e584b62fc8dc89f0e74dde18c989f3c4a
4
+ data.tar.gz: 4bf6daf82bb9958e9d042b75f03d424be2f985ec02ffc3b18aef68f3b8a3b47c
5
5
  SHA512:
6
- metadata.gz: 12a54683c41202563b1d1558c0abdb2c32218505289a14a83744dc3ea630d518e012dbd67c8c787b6a5d24f75e1514e31c745c8195bce3d4d8a933493c671061
7
- data.tar.gz: ecc1b37817bd4c0f897811d56ec853c1a84f28c9a6ac24bc9e466c17f8a2d9061ed572050aefe5dc48e33c498b4cb571d424c081896e178e45b74d71b77a6ed9
6
+ metadata.gz: 61de44ede7ebe2d0f79c642648edf6ec9e7894c05d5e36a0d8f4dbf15f82dc66d43c0320819459d4034a8c9dc8b42b6ae2c69f2946b200160cf6eebc7a6c3aae
7
+ data.tar.gz: 16ef6c35ed6ef86b4ad420baaa2ecac77b513065d68a7c9b7380d910d1318a5e4ee1ac314fa7d69e0474333761f3e615bad1ff817e84dbf132c6b74042f6d7bd
data/README.md CHANGED
@@ -39,6 +39,7 @@ yarn run jasmine:ci
39
39
 
40
40
  - [Install and use this gem](docs/install-and-use.md)
41
41
  - [Use a component in your application](docs/use-components.md)
42
+ - [Test a branch of the gem](docs/test-a-branch-of-the-gem.md)
42
43
 
43
44
  ### Managing the gem
44
45
 
@@ -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 One Login signup endpoint of /email-signup.
62
+ data:
63
+ base_path: '/current-page-path'
64
+ js_enhancement: true
65
+ skip_account: true
@@ -153,9 +153,9 @@ en:
153
153
  navigation:
154
154
  menu_bar:
155
155
  account:
156
- link_text: Your account
156
+ link_text: Your GOV.UK One Login
157
157
  manage:
158
- link_text: Manage your account
158
+ link_text: Settings
159
159
  layout_header:
160
160
  hide_button: Hide search
161
161
  menu: Menu
@@ -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.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-08 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config