govuk_publishing_components 30.3.0 → 30.4.0
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/analytics-ga4/ga4-link-tracker.js +17 -3
- data/app/assets/stylesheets/component_guide/application.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +7 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -1
- data/app/models/govuk_publishing_components/component_example.rb +3 -2
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +26 -2
- data/config/locales/en.yml +4 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/sortablejs/README.md +828 -815
- data/node_modules/sortablejs/Sortable.js +186 -113
- data/node_modules/sortablejs/Sortable.min.js +2 -2
- data/node_modules/sortablejs/modular/sortable.complete.esm.js +184 -111
- data/node_modules/sortablejs/modular/sortable.core.esm.js +184 -111
- data/node_modules/sortablejs/modular/sortable.esm.js +184 -111
- data/node_modules/sortablejs/package.json +3 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d544979af086e1b51d9bc444a8df7915e8bfbb5408cd57bd810e895d82bb6248
|
4
|
+
data.tar.gz: df81a0cc285b349a82f5f74c16131ccf5b4729103c93aa7a7ea0f9c897791012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db5a2631e57d734da3540471a07974d71a73d95ac013bc5d9dcd9185decc34602dd99dd110d6c3092971bf44096d92e9c26967ba33bd2c79b21a465179d7ea7f
|
7
|
+
data.tar.gz: 5fca1e9effe07e496bba47fb30ad6b9ff32e99a81b675812c0ae8c27cf51610e04616aa3d3d1b5cc5939dd1fd26cc1209a20c6a95ac7e4f4c41cc82e0fad88a4
|
@@ -44,18 +44,20 @@
|
|
44
44
|
}
|
45
45
|
|
46
46
|
if (this.isMailToLink(href)) {
|
47
|
+
clickData.event_name = 'navigation'
|
47
48
|
clickData.type = 'email'
|
48
49
|
clickData.external = 'true'
|
49
50
|
} else if (this.isDownloadLink(href)) {
|
50
|
-
clickData.
|
51
|
-
clickData.
|
51
|
+
clickData.event_name = 'file_download'
|
52
|
+
clickData.type = this.isPreviewLink(href) ? 'preview' : 'generic download'
|
53
|
+
clickData.external = 'true'
|
52
54
|
} else if (this.isExternalLink(href)) {
|
55
|
+
clickData.event_name = 'navigation'
|
53
56
|
clickData.type = 'generic link'
|
54
57
|
clickData.external = 'true'
|
55
58
|
}
|
56
59
|
|
57
60
|
if (Object.keys(clickData).length > 0) {
|
58
|
-
clickData.event_name = 'navigation'
|
59
61
|
clickData.text = element.textContent.trim()
|
60
62
|
clickData.url = href
|
61
63
|
clickData.link_method = this.getClickType(event)
|
@@ -129,6 +131,18 @@
|
|
129
131
|
}
|
130
132
|
},
|
131
133
|
|
134
|
+
isPreviewLink: function (href) {
|
135
|
+
/* Regex looks for:
|
136
|
+
1. The file extension period (the character '.')
|
137
|
+
2. any alphanumeric characters (so we can match any file type such as jpg, pdf, mp4.)
|
138
|
+
3. the presence of '/preview'.
|
139
|
+
For example, .csv/preview or .mp4/preview will be matched.
|
140
|
+
Regex is used over JS string methods as this should work with anchor links, query string parameters and files that may have 'preview' in their name.
|
141
|
+
*/
|
142
|
+
var previewRegex = /\.\w+\/preview/i
|
143
|
+
return previewRegex.test(href)
|
144
|
+
},
|
145
|
+
|
132
146
|
hrefPointsToDomain: function (href, domain) {
|
133
147
|
var httpDomain = 'http://' + domain
|
134
148
|
var httpsDomain = 'https://' + domain
|
@@ -12,3 +12,10 @@
|
|
12
12
|
.gem-c-layout-footer .govuk-footer__list {
|
13
13
|
padding-bottom: govuk-spacing(7);
|
14
14
|
}
|
15
|
+
|
16
|
+
.gem-c-layout-footer .govuk-footer__list-item:nth-child(odd):last-child {
|
17
|
+
// If there are an uneven number of links in the
|
18
|
+
// footer this ensures the left column has more links than the
|
19
|
+
// the right column.
|
20
|
+
margin-bottom: 20px;
|
21
|
+
}
|
@@ -811,7 +811,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
811
811
|
|
812
812
|
.gem-c-layout-super-navigation-header__navigation-second-items--topics {
|
813
813
|
@include govuk-media-query($from: "desktop") {
|
814
|
-
@include columns($items:
|
814
|
+
@include columns($items: 17, $columns: 2, $selector: "li", $flow: column);
|
815
815
|
}
|
816
816
|
}
|
817
817
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "rouge"
|
2
|
+
require "awesome_print"
|
2
3
|
|
3
4
|
module GovukPublishingComponents
|
4
5
|
class ComponentExample
|
@@ -29,8 +30,8 @@ module GovukPublishingComponents
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def pretty_data
|
32
|
-
json_key_regex = /"(\w*)"
|
33
|
-
output =
|
33
|
+
json_key_regex = /"(\w*)"\s*:/ # matches quoted keys ending with a colon, i.e. "key":
|
34
|
+
output = data.awesome_inspect(indent: -2, index: false, plain: true).gsub("=>", ":").gsub(json_key_regex, '\1:')
|
34
35
|
|
35
36
|
quoted_string_regex = /"((?:[^"\\]|\\.)*)"/ # matches "some text" - ignores escaped quotes, i.e. \"
|
36
37
|
output.gsub(quoted_string_regex) do |group|
|
@@ -28,7 +28,30 @@
|
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
|
31
|
-
|
31
|
+
<% if @component_doc.other_examples.any? %>
|
32
|
+
<div class="component-doc__content-list">
|
33
|
+
<%
|
34
|
+
content_items = [
|
35
|
+
{
|
36
|
+
href: "#default",
|
37
|
+
text: "How it looks",
|
38
|
+
}
|
39
|
+
]
|
40
|
+
|
41
|
+
@component_doc.other_examples.each do | example |
|
42
|
+
content_items << {
|
43
|
+
href: "##{example.id}",
|
44
|
+
text: example.name
|
45
|
+
}
|
46
|
+
end
|
47
|
+
%>
|
48
|
+
<%= render "govuk_publishing_components/components/contents_list", {
|
49
|
+
contents: content_items
|
50
|
+
} %>
|
51
|
+
</div>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<h2 class="component-doc-h2" id="default">
|
32
55
|
<a href="<%= component_example_path(@component_doc.id, "default") %>" class="govuk-link">How it looks</a>
|
33
56
|
<small>(<a href="<%= component_preview_path(@component_doc.id, "default") %>" class="govuk-link">preview</a>)</small>
|
34
57
|
<small>(<a href="<%= component_preview_all_path(@component_doc.id) %>" class="govuk-link">preview all</a>)</small>
|
@@ -65,8 +88,9 @@
|
|
65
88
|
<% if @component_doc.other_examples.any? %>
|
66
89
|
<div class="examples">
|
67
90
|
<h2 class="component-doc-h2">Other examples</h2>
|
91
|
+
|
68
92
|
<% @component_doc.other_examples.each do |example| %>
|
69
|
-
<div class="component-example">
|
93
|
+
<div class="component-example" id="<%= example.id %>">
|
70
94
|
<h3 class="example-title">
|
71
95
|
<a href="<%= component_example_path(@component_doc.id, example.id) %>" class="govuk-link"><%= example.name %></a>
|
72
96
|
<small>(<a href="<%= component_preview_path(@component_doc.id, example.id) %>" class="govuk-link">preview</a>)</small>
|
data/config/locales/en.yml
CHANGED
@@ -96,6 +96,8 @@ en:
|
|
96
96
|
href: "/browse/childcare-parenting"
|
97
97
|
- text: Citizenship and living in the UK
|
98
98
|
href: "/browse/citizenship"
|
99
|
+
- text: Cost of living support
|
100
|
+
href: "/cost-of-living"
|
99
101
|
- text: Crime, justice and the law
|
100
102
|
href: "/browse/justice"
|
101
103
|
- text: Disabled people
|
@@ -175,6 +177,8 @@ en:
|
|
175
177
|
href: "/browse/childcare-parenting"
|
176
178
|
- label: Citizenship and living in the UK
|
177
179
|
href: "/browse/citizenship"
|
180
|
+
- label: Cost of living support
|
181
|
+
href: "/cost-of-living"
|
178
182
|
- label: Crime, justice and the law
|
179
183
|
href: "/browse/justice"
|
180
184
|
- label: Disabled people
|