govuk_publishing_components 27.11.0 → 27.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +48 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +6 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +172 -119
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_prefixed-transform.scss +5 -0
- data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +9 -0
- data/app/views/govuk_publishing_components/components/_big_number.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_input.html.erb +35 -22
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_search.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +7 -13
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +4 -5
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -6
- data/app/views/govuk_publishing_components/components/docs/input.yml +10 -0
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +7 -0
- data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +21 -3
- data/config/locales/ar.yml +0 -3
- data/config/locales/az.yml +0 -3
- data/config/locales/be.yml +0 -3
- data/config/locales/bg.yml +0 -3
- data/config/locales/bn.yml +0 -3
- data/config/locales/cs.yml +0 -3
- data/config/locales/cy.yml +0 -3
- data/config/locales/da.yml +0 -3
- data/config/locales/de.yml +0 -3
- data/config/locales/dr.yml +0 -3
- data/config/locales/el.yml +0 -3
- data/config/locales/en.yml +1 -6
- data/config/locales/es-419.yml +0 -3
- data/config/locales/es.yml +0 -3
- data/config/locales/et.yml +0 -3
- data/config/locales/fa.yml +0 -3
- data/config/locales/fi.yml +0 -3
- data/config/locales/fr.yml +0 -3
- data/config/locales/gd.yml +0 -3
- data/config/locales/gu.yml +0 -3
- data/config/locales/he.yml +0 -3
- data/config/locales/hi.yml +0 -3
- data/config/locales/hr.yml +0 -3
- data/config/locales/hu.yml +0 -3
- data/config/locales/hy.yml +0 -3
- data/config/locales/id.yml +0 -3
- data/config/locales/is.yml +0 -3
- data/config/locales/it.yml +0 -3
- data/config/locales/ja.yml +0 -3
- data/config/locales/ka.yml +0 -3
- data/config/locales/kk.yml +0 -3
- data/config/locales/ko.yml +0 -3
- data/config/locales/lt.yml +0 -3
- data/config/locales/lv.yml +0 -3
- data/config/locales/ms.yml +0 -3
- data/config/locales/mt.yml +0 -3
- data/config/locales/nl.yml +0 -3
- data/config/locales/no.yml +0 -3
- data/config/locales/pa-pk.yml +0 -3
- data/config/locales/pa.yml +0 -3
- data/config/locales/pl.yml +0 -3
- data/config/locales/ps.yml +0 -3
- data/config/locales/pt.yml +0 -3
- data/config/locales/ro.yml +0 -3
- data/config/locales/ru.yml +0 -3
- data/config/locales/si.yml +0 -3
- data/config/locales/sk.yml +0 -3
- data/config/locales/sl.yml +0 -3
- data/config/locales/so.yml +0 -3
- data/config/locales/sq.yml +0 -3
- data/config/locales/sr.yml +0 -3
- data/config/locales/sv.yml +0 -3
- data/config/locales/sw.yml +0 -3
- data/config/locales/ta.yml +0 -3
- data/config/locales/th.yml +0 -3
- data/config/locales/tk.yml +0 -3
- data/config/locales/tr.yml +0 -3
- data/config/locales/uk.yml +0 -3
- data/config/locales/ur.yml +0 -3
- data/config/locales/uz.yml +0 -3
- data/config/locales/vi.yml +0 -3
- data/config/locales/zh-hk.yml +0 -3
- data/config/locales/zh-tw.yml +0 -3
- data/config/locales/zh.yml +0 -3
- data/lib/govuk_publishing_components/presenters/button_helper.rb +1 -0
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +15 -4
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +40 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -1
- metadata +5 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_summary.scss +0 -27
- data/lib/govuk_publishing_components/presenters/brexit_cta_helper.rb +0 -33
data/config/locales/it.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/ka.yml
CHANGED
data/config/locales/kk.yml
CHANGED
data/config/locales/ko.yml
CHANGED
data/config/locales/lt.yml
CHANGED
data/config/locales/lv.yml
CHANGED
data/config/locales/ms.yml
CHANGED
data/config/locales/mt.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/no.yml
CHANGED
data/config/locales/pa-pk.yml
CHANGED
data/config/locales/pa.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/ps.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/ro.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/config/locales/si.yml
CHANGED
data/config/locales/sk.yml
CHANGED
data/config/locales/sl.yml
CHANGED
data/config/locales/so.yml
CHANGED
data/config/locales/sq.yml
CHANGED
data/config/locales/sr.yml
CHANGED
data/config/locales/sv.yml
CHANGED
data/config/locales/sw.yml
CHANGED
data/config/locales/ta.yml
CHANGED
data/config/locales/th.yml
CHANGED
data/config/locales/tk.yml
CHANGED
data/config/locales/tr.yml
CHANGED
data/config/locales/uk.yml
CHANGED
data/config/locales/ur.yml
CHANGED
data/config/locales/uz.yml
CHANGED
data/config/locales/vi.yml
CHANGED
data/config/locales/zh-hk.yml
CHANGED
data/config/locales/zh-tw.yml
CHANGED
data/config/locales/zh.yml
CHANGED
@@ -66,6 +66,7 @@ module GovukPublishingComponents
|
|
66
66
|
options[:name] = name if name.present? && value.present?
|
67
67
|
options[:value] = value if name.present? && value.present?
|
68
68
|
options[:aria] = { label: aria_label } if aria_label
|
69
|
+
options[:draggable] = false if link?
|
69
70
|
options
|
70
71
|
end
|
71
72
|
|
@@ -111,10 +111,10 @@ module GovukPublishingComponents
|
|
111
111
|
def show_brexit_related_links?
|
112
112
|
# If tagged directly to /brexit or /world/brexit
|
113
113
|
# Or if tagged to a taxon which has /brexit as a parent
|
114
|
-
# And is not the brexit
|
115
|
-
|
116
|
-
|
117
|
-
tagged_to_brexit?
|
114
|
+
# And is not the brexit hub pages
|
115
|
+
return false if brexit_hub_pages.include?(content_item["content_id"])
|
116
|
+
|
117
|
+
tagged_to_brexit?
|
118
118
|
end
|
119
119
|
|
120
120
|
def brexit_cta_document_exceptions
|
@@ -179,6 +179,17 @@ module GovukPublishingComponents
|
|
179
179
|
4ca8698b-4a24-45ff-baea-7633cc24b679
|
180
180
|
ed73581f-9bf8-48b5-bb66-935581a255e3
|
181
181
|
15f1c594-af1d-4f16-97cc-ad4d12017509
|
182
|
+
] + brexit_hub_pages
|
183
|
+
end
|
184
|
+
|
185
|
+
# we don't want to show the standard Brexit sidebar nav on
|
186
|
+
# https://www.gov.uk/guidance/brexit-guidance-for-individuals-and-families or
|
187
|
+
# https://www.gov.uk/guidance/brexit-guidance-for-businesses
|
188
|
+
# as it might result in circular journeys
|
189
|
+
def brexit_hub_pages
|
190
|
+
%w[
|
191
|
+
91cd6143-69d5-4f27-99ff-a52fb0d51c78
|
192
|
+
6555e0bf-c270-4cf9-a0c5-d20b95fab7f1
|
182
193
|
]
|
183
194
|
end
|
184
195
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class SinglePageNotificationButtonHelper
|
4
|
+
attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location
|
5
|
+
|
6
|
+
def initialize(local_assigns)
|
7
|
+
@local_assigns = local_assigns
|
8
|
+
@data_attributes = @local_assigns[:data_attributes] || {}
|
9
|
+
@js_enhancement = @local_assigns[:js_enhancement] || false
|
10
|
+
@already_subscribed = @local_assigns[:already_subscribed] || false
|
11
|
+
@base_path = @local_assigns[:base_path] || nil
|
12
|
+
@button_location = button_location_is_valid? ? @local_assigns[:button_location] : nil
|
13
|
+
@button_type = @local_assigns[:already_subscribed] ? "Unsubscribe" : "Subscribe"
|
14
|
+
end
|
15
|
+
|
16
|
+
def data
|
17
|
+
module_names = %w[gem-track-click]
|
18
|
+
module_names << "single-page-notification-button" if js_enhancement
|
19
|
+
|
20
|
+
@data_attributes[:label] = base_path
|
21
|
+
# data-action for tracking should have the format of e.g. "Unsubscribe-button-top", or "Subscribe-button-bottom"
|
22
|
+
# when button_location is not present data-action will fall back to "Unsubscribe-button"/"Subscribe-button"
|
23
|
+
@data_attributes[:action] = [button_type, "button", button_location].compact.join("-")
|
24
|
+
@data_attributes[:module] = module_names.join(" ")
|
25
|
+
@data_attributes[:category] = "Single-page-notification-button"
|
26
|
+
# This attribute is passed through to the personalisation API to ensure when a new button is returned from the API, it has the same button_location
|
27
|
+
@data_attributes[:button_location] = button_location
|
28
|
+
@data_attributes
|
29
|
+
end
|
30
|
+
|
31
|
+
def button_location_is_valid?
|
32
|
+
%w[bottom top].include? @local_assigns[:button_location]
|
33
|
+
end
|
34
|
+
|
35
|
+
def button_text
|
36
|
+
@already_subscribed ? I18n.t("components.single_page_notification_button.unsubscribe_text") : I18n.t("components.single_page_notification_button.subscribe_text")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -8,7 +8,6 @@ require "govuk_publishing_components/presenters/shared_helper"
|
|
8
8
|
require "govuk_publishing_components/presenters/attachment"
|
9
9
|
require "govuk_publishing_components/presenters/breadcrumbs"
|
10
10
|
require "govuk_publishing_components/presenters/breadcrumb_selector"
|
11
|
-
require "govuk_publishing_components/presenters/brexit_cta_helper"
|
12
11
|
require "govuk_publishing_components/presenters/button_helper"
|
13
12
|
require "govuk_publishing_components/presenters/contextual_navigation"
|
14
13
|
require "govuk_publishing_components/presenters/devolved_nations_helper"
|
@@ -34,6 +33,7 @@ require "govuk_publishing_components/presenters/intervention_helper"
|
|
34
33
|
require "govuk_publishing_components/presenters/organisation_logo_helper"
|
35
34
|
require "govuk_publishing_components/presenters/highlight_boxes_helper"
|
36
35
|
require "govuk_publishing_components/presenters/taxonomy_list_helper"
|
36
|
+
require "govuk_publishing_components/presenters/single_page_notification_button_helper"
|
37
37
|
|
38
38
|
require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
|
39
39
|
require "govuk_publishing_components/app_helpers/table_helper"
|
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: 27.
|
4
|
+
version: 27.14.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: 2021-11-
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -501,6 +501,7 @@ files:
|
|
501
501
|
- app/assets/javascripts/govuk_publishing_components/components/radio.js
|
502
502
|
- app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js
|
503
503
|
- app/assets/javascripts/govuk_publishing_components/components/show-password.js
|
504
|
+
- app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js
|
504
505
|
- app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
|
505
506
|
- app/assets/javascripts/govuk_publishing_components/components/tabs.js
|
506
507
|
- app/assets/javascripts/govuk_publishing_components/dependencies.js
|
@@ -624,7 +625,6 @@ files:
|
|
624
625
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss
|
625
626
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss
|
626
627
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss
|
627
|
-
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_summary.scss
|
628
628
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss
|
629
629
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss
|
630
630
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss
|
@@ -637,6 +637,7 @@ files:
|
|
637
637
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_govuk-template-link-focus-override.scss
|
638
638
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss
|
639
639
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_media-down.scss
|
640
|
+
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_prefixed-transform.scss
|
640
641
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss
|
641
642
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_button.scss
|
642
643
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_contents-list.scss
|
@@ -931,7 +932,6 @@ files:
|
|
931
932
|
- lib/govuk_publishing_components/presenters/attachment.rb
|
932
933
|
- lib/govuk_publishing_components/presenters/breadcrumb_selector.rb
|
933
934
|
- lib/govuk_publishing_components/presenters/breadcrumbs.rb
|
934
|
-
- lib/govuk_publishing_components/presenters/brexit_cta_helper.rb
|
935
935
|
- lib/govuk_publishing_components/presenters/button_helper.rb
|
936
936
|
- lib/govuk_publishing_components/presenters/checkboxes_helper.rb
|
937
937
|
- lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors.rb
|
@@ -969,6 +969,7 @@ files:
|
|
969
969
|
- lib/govuk_publishing_components/presenters/schema_org.rb
|
970
970
|
- lib/govuk_publishing_components/presenters/select.rb
|
971
971
|
- lib/govuk_publishing_components/presenters/shared_helper.rb
|
972
|
+
- lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb
|
972
973
|
- lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
|
973
974
|
- lib/govuk_publishing_components/presenters/subscription_links_helper.rb
|
974
975
|
- lib/govuk_publishing_components/presenters/taxonomy_list_helper.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
.govspeak, // Legacy class name that's still used in some content items - needs to be kept until `.govspeak` is removed from the content items.
|
2
|
-
.gem-c-govspeak {
|
3
|
-
.summary {
|
4
|
-
margin: 0 0 2em;
|
5
|
-
padding: 0;
|
6
|
-
color: $govuk-text-colour;
|
7
|
-
|
8
|
-
p {
|
9
|
-
@include govuk-font($size: 19);
|
10
|
-
}
|
11
|
-
|
12
|
-
@include govuk-media-query($until: tablet) {
|
13
|
-
margin: 0 0 2em;
|
14
|
-
padding: 0;
|
15
|
-
}
|
16
|
-
|
17
|
-
p,
|
18
|
-
h2 {
|
19
|
-
border: 0;
|
20
|
-
margin: 0 .75em 0 0;
|
21
|
-
}
|
22
|
-
|
23
|
-
h2 {
|
24
|
-
line-height: 1.35em;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module GovukPublishingComponents
|
2
|
-
module Presenters
|
3
|
-
class BrexitCtaHelper
|
4
|
-
BREXIT_HUB_PAGE_IDS = %w[
|
5
|
-
6555e0bf-c270-4cf9-a0c5-d20b95fab7f1
|
6
|
-
91cd6143-69d5-4f27-99ff-a52fb0d51c78
|
7
|
-
].freeze
|
8
|
-
|
9
|
-
def initialize(content_item)
|
10
|
-
@content_item = content_item
|
11
|
-
end
|
12
|
-
|
13
|
-
def title_key
|
14
|
-
use_brexit_hub_page_navigation? ? "components.related_navigation.transition.hub_page_title" : "components.related_navigation.transition.title"
|
15
|
-
end
|
16
|
-
|
17
|
-
def link_text_key
|
18
|
-
use_brexit_hub_page_navigation? ? "components.related_navigation.transition.hub_page_link_text" : "components.related_navigation.transition.link_text"
|
19
|
-
end
|
20
|
-
|
21
|
-
def link_path_key
|
22
|
-
use_brexit_hub_page_navigation? ? "components.related_navigation.transition.hub_page_link_path" : "components.related_navigation.transition.link_path"
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def use_brexit_hub_page_navigation?
|
28
|
-
I18n.locale == :en &&
|
29
|
-
BREXIT_HUB_PAGE_IDS.include?(@content_item["content_id"])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|