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 +4 -4
- data/README.md +1 -0
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +6 -0
- data/config/locales/en.yml +2 -2
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +18 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8b043d1285aa3d0477957b2472686e584b62fc8dc89f0e74dde18c989f3c4a
|
4
|
+
data.tar.gz: 4bf6daf82bb9958e9d042b75f03d424be2f985ec02ffc3b18aef68f3b8a3b47c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61de44ede7ebe2d0f79c642648edf6ec9e7894c05d5e36a0d8f4dbf15f82dc66d43c0320819459d4034a8c9dc8b42b6ae2c69f2946b200160cf6eebc7a6c3aae
|
7
|
+
data.tar.gz: 16ef6c35ed6ef86b4ad420baaa2ecac77b513065d68a7c9b7380d910d1318a5e4ee1ac314fa7d69e0474333761f3e615bad1ff817e84dbf132c6b74042f6d7bd
|
data/README.md
CHANGED
data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb
CHANGED
@@ -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:
|
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",
|
data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml
CHANGED
@@ -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
|
data/config/locales/en.yml
CHANGED
@@ -153,9 +153,9 @@ en:
|
|
153
153
|
navigation:
|
154
154
|
menu_bar:
|
155
155
|
account:
|
156
|
-
link_text: Your
|
156
|
+
link_text: Your GOV.UK One Login
|
157
157
|
manage:
|
158
|
-
link_text:
|
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
|
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.
|
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-
|
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
|