govuk_publishing_components 23.7.1 → 23.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/component_support.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_govuk-template-link-focus-override.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +3 -3
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_transition_countdown.html.erb +6 -5
- data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +1 -1
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
- data/config/locales/en.yml +1 -1
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +0 -40
- data/lib/govuk_publishing_components/presenters/shared_helper.rb +42 -0
- data/lib/govuk_publishing_components/presenters/subscription_links_helper.rb +2 -2
- 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: 1edd09d1efa0a5d378ebd7a13383f7de12dc41f7928e36c3b12194cfb96afe32
|
4
|
+
data.tar.gz: d81001fc9228d15ac67b2b42b7ede030969e0d8b02551e92682aa9737c0a76aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 896f5562e07f5ccb4d35c35002f03a883941eb92dc3b7e73e594ff6acd50f39416789ee345e25a5ed560469ee308a85a1df7ee084cf23e240ba5c90fa80565cc
|
7
|
+
data.tar.gz: 31e88d2547c8bfb98f70d69e4ec403e9a920a1b6796be51fe9101b1cd77893bca6945339c327ae2726e68c5690caccdbd3497d279b27f84f0f55a89bb9c3a28e
|
data/README.md
CHANGED
@@ -22,6 +22,7 @@ Components should be added to this gem if they are required in more than one app
|
|
22
22
|
- [Run the component guide](/docs/run-component-guide.md)
|
23
23
|
- [Move a component from an application to the gem](/docs/moving-components-upstream-into-this-gem.md)
|
24
24
|
- [Publish/release a new version of the gem](/docs/publishing-to-rubygems.md)
|
25
|
+
- [Keep this gem in sync with the Design System](/docs/upgrade-govuk-frontend.md)
|
25
26
|
|
26
27
|
## Architecture / structure
|
27
28
|
|
@@ -39,13 +40,13 @@ There are 2 types of helper classes in this app:
|
|
39
40
|
GOV.UK Publishing Components also makes [GOV.UK Design System](https://design-system.service.gov.uk/) styles and components available to GOV.UK's frontend applications. This gem consumes [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) via [Yarn](https://classic.yarnpkg.com/).
|
40
41
|
|
41
42
|
## Browser and assistive technology support
|
43
|
+
|
42
44
|
GOV.UK Publishing Components shares the same standards in terms of browser and assistive technology support with [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend#browser-and-assistive-technology-support).
|
43
45
|
|
44
46
|
## Documentation
|
45
47
|
|
46
48
|
[See the rubydoc.info documentation](http://www.rubydoc.info/gems/govuk_publishing_components)
|
47
49
|
|
48
|
-
|
49
50
|
## Working locally
|
50
51
|
|
51
52
|
### Install dependencies
|
@@ -215,8 +215,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
215
215
|
return !isNaN(parseFloat(val))
|
216
216
|
},
|
217
217
|
stripValue: function (val) {
|
218
|
-
|
219
|
-
return val.replace(re, '')
|
218
|
+
return val.replace(/,|£|%|[a-z]/gi, '')
|
220
219
|
},
|
221
220
|
returnMax: function (values) {
|
222
221
|
var max = 0
|
@@ -9,6 +9,7 @@
|
|
9
9
|
@import "govuk_publishing_components/components/helpers/variables";
|
10
10
|
@import "govuk_publishing_components/components/helpers/brand-colours";
|
11
11
|
@import "govuk_publishing_components/components/helpers/link";
|
12
|
+
@import "govuk_publishing_components/components/helpers/px-to-em";
|
12
13
|
@import "govuk_publishing_components/components/mixins/govuk-template-link-focus-override";
|
13
14
|
@import "govuk_publishing_components/components/mixins/media-down";
|
14
15
|
@import "govuk_publishing_components/components/mixins/margins";
|
@@ -39,7 +39,7 @@ $large-input-size: 50px;
|
|
39
39
|
padding: 6px;
|
40
40
|
margin: 0;
|
41
41
|
width: 100%;
|
42
|
-
height:
|
42
|
+
height: em(34, 16);
|
43
43
|
border: $govuk-border-width-form-element solid $govuk-input-border-colour;
|
44
44
|
background: govuk-colour("white");
|
45
45
|
border-radius: 0; //otherwise iphones apply an automatic border radius
|
@@ -40,7 +40,7 @@ $share-button-height: 32px;
|
|
40
40
|
left: 0;
|
41
41
|
width: $share-button-width;
|
42
42
|
height: $share-button-height;
|
43
|
-
|
43
|
+
line-height: $share-button-height;
|
44
44
|
}
|
45
45
|
|
46
46
|
.direction-rtl {
|
@@ -61,7 +61,7 @@ $share-button-height: 32px;
|
|
61
61
|
}
|
62
62
|
}
|
63
63
|
|
64
|
-
$column-width:
|
64
|
+
$column-width: 9.5em;
|
65
65
|
|
66
66
|
.gem-c-share-links--columns {
|
67
67
|
.gem-c-share-links__list {
|
@@ -152,7 +152,7 @@
|
|
152
152
|
}
|
153
153
|
|
154
154
|
.mc-value-overflow {
|
155
|
-
text-indent: -99999px !important;
|
155
|
+
text-indent: -99999px !important; // stylelint-disable-line declaration-no-important
|
156
156
|
}
|
157
157
|
|
158
158
|
// Bar labels
|
@@ -178,7 +178,7 @@
|
|
178
178
|
|
179
179
|
.mc-stacked-total {
|
180
180
|
padding: $bar-padding 0;
|
181
|
-
background-color: transparent !important;
|
181
|
+
background-color: transparent !important; // stylelint-disable-line declaration-no-important
|
182
182
|
color: govuk-colour("black");
|
183
183
|
display: inline-block;
|
184
184
|
text-indent: 5px;
|
@@ -12,10 +12,10 @@
|
|
12
12
|
|
13
13
|
@for $i from 1 through 30 {
|
14
14
|
&:nth-child(#{$i}) {
|
15
|
-
background-image: url("data:image/svg+xml
|
15
|
+
background-image: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 250' preserveAspectRatio='xMinYMin meet'%3E%3Cg%3E%3Ccircle r='50%25' cx='50%25' cy='50%25' class='circle-back'%3E%3C/circle%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='0.3em' font-family='nta,arial,sans-serif' font-size='8rem' fill='%23ffffff'%3E#{$i}%3C/text%3E%3C/g%3E%3C/svg%3E ");
|
16
16
|
background-repeat: no-repeat;
|
17
|
-
background-position:
|
18
|
-
background-size:
|
17
|
+
background-position: .2em .7em;
|
18
|
+
background-size: 1.4em 1.4em;
|
19
19
|
}
|
20
20
|
}
|
21
21
|
}
|
@@ -6,12 +6,12 @@
|
|
6
6
|
|
7
7
|
// Open all of the accordion sections.
|
8
8
|
.govuk-accordion__section-content {
|
9
|
-
display: block !important;
|
9
|
+
display: block !important; // stylelint-disable-line declaration-no-important
|
10
10
|
}
|
11
11
|
|
12
12
|
// Change the colour from the blue link colour to black.
|
13
13
|
.govuk-accordion__section-button {
|
14
|
-
color: govuk-colour("black") !important;
|
14
|
+
color: govuk-colour("black") !important; // stylelint-disable-line declaration-no-important
|
15
15
|
}
|
16
16
|
|
17
17
|
// Change the summary subheading size.
|
@@ -27,5 +27,5 @@
|
|
27
27
|
// Hide the unusable "Open all" button and the "+" icons.
|
28
28
|
.govuk-accordion__open-all,
|
29
29
|
.govuk-accordion__icon {
|
30
|
-
display: none !important;
|
30
|
+
display: none !important; // stylelint-disable-line declaration-no-important
|
31
31
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
|
2
|
+
<% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
|
2
3
|
|
3
4
|
<div class="gem-c-contextual-sidebar">
|
4
5
|
<% if navigation.show_brexit_cta? && navigation.step_by_step_count.zero? %>
|
@@ -16,7 +17,7 @@
|
|
16
17
|
"track-dimension": t("components.related_navigation.transition.link_text"),
|
17
18
|
"track-dimension-index": "29",
|
18
19
|
},
|
19
|
-
lang:
|
20
|
+
lang: shared_helper.t_locale("components.related_navigation.transition.title"),
|
20
21
|
} %>
|
21
22
|
<% end %>
|
22
23
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% related_nav_helper = GovukPublishingComponents::Presenters::RelatedNavigationHelper.new(local_assigns) %>
|
2
|
+
<% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
|
2
3
|
|
3
4
|
<% if related_nav_helper.related_navigation? %>
|
4
5
|
<% random = SecureRandom.hex(4) %>
|
@@ -8,7 +9,7 @@
|
|
8
9
|
<h2 id="related-nav-related_items-<%= random %>"
|
9
10
|
class="gem-c-related-navigation__main-heading"
|
10
11
|
data-track-count="sidebarRelatedItemSection"
|
11
|
-
<%=
|
12
|
+
<%= shared_helper.t_lang(
|
12
13
|
"components.related_#{local_assigns[:context]}_navigation.related_content",
|
13
14
|
default: 'components.related_navigation.related_content'
|
14
15
|
)
|
@@ -28,6 +29,7 @@
|
|
28
29
|
|
29
30
|
<%= render 'govuk_publishing_components/components/related_navigation/section',
|
30
31
|
related_nav_helper: related_nav_helper,
|
32
|
+
shared_helper: shared_helper,
|
31
33
|
section_title: section_title,
|
32
34
|
links: links,
|
33
35
|
section_index: section_index,
|
@@ -7,10 +7,11 @@
|
|
7
7
|
text ||= nil
|
8
8
|
url ||= nil
|
9
9
|
data_attributes ||= {}
|
10
|
-
lang ||=
|
10
|
+
lang ||= "en"
|
11
|
+
direction ||= "ltr"
|
11
12
|
css_classes = %w(gem-c-transition-countdown)
|
12
|
-
css_classes <<
|
13
|
-
css_classes <<
|
13
|
+
css_classes << "gem-c-transition-countdown--cta" if url
|
14
|
+
css_classes << "govuk-link" if url
|
14
15
|
%>
|
15
16
|
|
16
17
|
<% countdown = capture do %>
|
@@ -24,11 +25,11 @@
|
|
24
25
|
<% end %>
|
25
26
|
|
26
27
|
<% if url %>
|
27
|
-
<%= link_to url, class: css_classes, data: data_attributes, lang: lang do %>
|
28
|
+
<%= link_to url, class: css_classes, data: data_attributes, lang: lang, dir: direction do %>
|
28
29
|
<%= countdown %>
|
29
30
|
<% end %>
|
30
31
|
<% else %>
|
31
|
-
<%= tag.div class: css_classes, lang: lang do %>
|
32
|
+
<%= tag.div class: css_classes, lang: lang, dir: direction do %>
|
32
33
|
<%= countdown %>
|
33
34
|
<% end %>
|
34
35
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
name: Subscription links
|
2
|
-
description: Links to ‘Get
|
2
|
+
description: Links to ‘Get emails’ and ‘Subscribe to feed’
|
3
3
|
body: |
|
4
4
|
<strong>NOTE: This component includes a h2 heading by default but can be suppressed by using `hide_heading` option (see below)<strong>
|
5
5
|
accessibility_criteria: |
|
@@ -28,7 +28,7 @@
|
|
28
28
|
link[:path],
|
29
29
|
class: related_nav_helper.section_css_class("gem-c-related-navigation__section-link", section_title, link, (index >= section_link_limit)),
|
30
30
|
rel: link[:rel],
|
31
|
-
lang:
|
31
|
+
lang: shared_helper.t_locale_check(link[:locale]),
|
32
32
|
data: {
|
33
33
|
track_category: 'relatedLinkClicked',
|
34
34
|
track_action: "#{section_index}.#{index} #{related_nav_helper.construct_section_heading(section_title) || t('components.related_navigation.related_content')}",
|
data/config/locales/en.yml
CHANGED
@@ -97,48 +97,8 @@ module GovukPublishingComponents
|
|
97
97
|
related_navigation.flat_map(&:last).any?
|
98
98
|
end
|
99
99
|
|
100
|
-
def t_locale(content, options = {})
|
101
|
-
# Check if the content string has a translation
|
102
|
-
content_translation_available = translation_present?(content)
|
103
|
-
|
104
|
-
# True, return locale
|
105
|
-
this_locale = I18n.locale if content_translation_available
|
106
|
-
# If false, return default locale
|
107
|
-
this_locale = I18n.default_locale unless content_translation_available
|
108
|
-
|
109
|
-
# Check if default string passed in
|
110
|
-
if options[:default].present?
|
111
|
-
# Check if the default string has a translation
|
112
|
-
default_translation_available = translation_present?(options[:default])
|
113
|
-
# If true, return locale
|
114
|
-
this_locale = I18n.locale if default_translation_available
|
115
|
-
# If false, return default_locale
|
116
|
-
this_locale = I18n.default_locale unless default_translation_available
|
117
|
-
end
|
118
|
-
|
119
|
-
this_locale
|
120
|
-
end
|
121
|
-
|
122
|
-
def t_lang(content, options = {})
|
123
|
-
locale = t_locale(content, options)
|
124
|
-
"lang=#{locale}" unless locale.eql?(I18n.locale)
|
125
|
-
end
|
126
|
-
|
127
|
-
def t_locale_check(locale)
|
128
|
-
locale.presence unless locale.to_s.eql?(I18n.locale.to_s)
|
129
|
-
end
|
130
|
-
|
131
100
|
private
|
132
101
|
|
133
|
-
def translation_present?(content)
|
134
|
-
default_string = "This is a string to act as a default for the `I18n.translate` method. Comparing the result reveals if there is a translation in the i18n files."
|
135
|
-
I18n.translate(
|
136
|
-
content,
|
137
|
-
default: default_string,
|
138
|
-
fallback: false,
|
139
|
-
) != default_string
|
140
|
-
end
|
141
|
-
|
142
102
|
def related_items
|
143
103
|
related_quick_links = content_item_details_for("quick_links")
|
144
104
|
|
@@ -30,6 +30,48 @@ module GovukPublishingComponents
|
|
30
30
|
|
31
31
|
"span"
|
32
32
|
end
|
33
|
+
|
34
|
+
def t_locale(content, options = {})
|
35
|
+
# Check if the content string has a translation
|
36
|
+
content_translation_available = translation_present?(content)
|
37
|
+
|
38
|
+
# True, return locale
|
39
|
+
this_locale = I18n.locale if content_translation_available
|
40
|
+
# If false, return default locale
|
41
|
+
this_locale = I18n.default_locale unless content_translation_available
|
42
|
+
|
43
|
+
# Check if default string passed in
|
44
|
+
if options[:default].present?
|
45
|
+
# Check if the default string has a translation
|
46
|
+
default_translation_available = translation_present?(options[:default])
|
47
|
+
# If true, return locale
|
48
|
+
this_locale = I18n.locale if default_translation_available
|
49
|
+
# If false, return default_locale
|
50
|
+
this_locale = I18n.default_locale unless default_translation_available
|
51
|
+
end
|
52
|
+
|
53
|
+
this_locale
|
54
|
+
end
|
55
|
+
|
56
|
+
def t_lang(content, options = {})
|
57
|
+
locale = t_locale(content, options)
|
58
|
+
"lang=#{locale}" unless locale.eql?(I18n.locale)
|
59
|
+
end
|
60
|
+
|
61
|
+
def t_locale_check(locale)
|
62
|
+
locale.presence unless locale.to_s.eql?(I18n.locale.to_s)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def translation_present?(content)
|
68
|
+
default_string = "This is a string to act as a default for the `I18n.translate` method. Comparing the result reveals if there is a translation in the i18n files."
|
69
|
+
I18n.translate(
|
70
|
+
content,
|
71
|
+
default: default_string,
|
72
|
+
fallback: false,
|
73
|
+
) != default_string
|
74
|
+
end
|
33
75
|
end
|
34
76
|
end
|
35
77
|
end
|
@@ -14,13 +14,13 @@ module GovukPublishingComponents
|
|
14
14
|
def email_signup_link_text
|
15
15
|
return @local_assigns[:email_signup_link_text] if @local_assigns[:email_signup_link_text]
|
16
16
|
|
17
|
-
I18n.t("
|
17
|
+
I18n.t("components.subscription_links.email_signup_link_text")
|
18
18
|
end
|
19
19
|
|
20
20
|
def feed_link_text
|
21
21
|
return @local_assigns[:feed_link_text] if @local_assigns[:feed_link_text]
|
22
22
|
|
23
|
-
I18n.t("
|
23
|
+
I18n.t("components.subscription_links.feed_link_text")
|
24
24
|
end
|
25
25
|
|
26
26
|
def component_data_is_valid?
|
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: 23.7.
|
4
|
+
version: 23.7.6
|
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: 2020-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|