govuk_publishing_components 34.8.0 → 34.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +7 -0
- 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: b6da9ed1af8922136300b056ca61432de28330b478e25e23334917d0fdec9041
|
4
|
+
data.tar.gz: 2efcf7e5c91aaca82158059670b6b5ea7d4f52cb998b49a23e13deb32276958e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5b8de64f9ba866ce83e1ef48be8d42f3f57b74891f446cba362c83e1a4be599d67039fc9f4cd9ee2e3b77345a4fb2955310a2aefb45b9bfcdf59e69bc06fdd3
|
7
|
+
data.tar.gz: 75251f6417ec2c5e3e542eab3f2a914b93c9a5153f6b3be40848640d1e4944d2186e169a26198760cac76f482667e1d73e743105504c465b31974c583b4a0f3f
|
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 account signup endpoint of /email-signup.
|
62
|
+
data:
|
63
|
+
base_path: '/current-page-path'
|
64
|
+
js_enhancement: true
|
65
|
+
skip_account: true
|
@@ -12,6 +12,9 @@ module GovukPublishingComponents
|
|
12
12
|
world_locations
|
13
13
|
statistical_data_sets
|
14
14
|
].freeze
|
15
|
+
WORLD_LOCATION_SPECIAL_CASES = {
|
16
|
+
"UK Mission to the European Union" => "uk-mission-to-the-eu",
|
17
|
+
}.freeze
|
15
18
|
|
16
19
|
def initialize(options = {})
|
17
20
|
@content_item = options.fetch(:content_item) { raise ArgumentError, "missing argument: content_item" }
|
@@ -112,6 +115,10 @@ module GovukPublishingComponents
|
|
112
115
|
|
113
116
|
def related_world_locations
|
114
117
|
content_item_links_for("world_locations")
|
118
|
+
.map do |link|
|
119
|
+
slug = WORLD_LOCATION_SPECIAL_CASES[link[:text]] || link[:text].parameterize
|
120
|
+
link.merge(path: "/world/#{slug}/news")
|
121
|
+
end
|
115
122
|
end
|
116
123
|
|
117
124
|
def related_statistical_data_sets
|
@@ -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.0
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|