govuk_publishing_components 24.6.1 → 24.7.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/components/details.js +2 -1
- data/app/assets/javascripts/govuk_publishing_components/modules.js +3 -1
- data/app/assets/stylesheets/component_guide/application.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +10 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +8 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +15 -1
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +48 -7
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +15 -12
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +3 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +26 -0
- data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +8 -1
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a7574209e732b2fdc01f77d8655487f1e22717a095577726c8fb3ab73cb5147
|
4
|
+
data.tar.gz: af0f5bb6c5b9639b8879e700cf89b22cc479d3ed44346cc3884d4d5c8261baab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09bbd9e420b9fc045fd8e9d8088bd15a586fb2281d5b639f33ed2d1f5138abf08e899fc06bab4f5f726f308792859e39d156e2355e3e2c486a40548854b32797'
|
7
|
+
data.tar.gz: 6b9fe00e353b48620e520b8507636a79668d02ccd8c1f5f3ac43ee296fd87287c6bd7c1229e13f203d3a18c966a33141c61a40881a2f92ec3abe2a0b5459d10c
|
@@ -1,7 +1,8 @@
|
|
1
1
|
/* eslint-env jquery */
|
2
2
|
// = require govuk/components/details/details.js
|
3
3
|
window.GOVUK = window.GOVUK || {}
|
4
|
-
window.GOVUK.Modules = window.GOVUK.Modules || {}
|
4
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {}
|
5
|
+
window.GOVUK.Modules.Details = window.GOVUKFrontend;
|
5
6
|
|
6
7
|
(function (Modules) {
|
7
8
|
function GovukDetails () { }
|
@@ -40,7 +40,9 @@
|
|
40
40
|
module = new GOVUK.Modules[moduleName]()
|
41
41
|
module.start(element)
|
42
42
|
element.data('module-started', true)
|
43
|
-
}
|
43
|
+
}
|
44
|
+
|
45
|
+
if ( // GOV.UK Frontend Modules
|
44
46
|
typeof GOVUK.Modules[frontendModuleName] === 'function' &&
|
45
47
|
GOVUK.Modules[frontendModuleName].prototype.init &&
|
46
48
|
!started
|
@@ -1,4 +1,13 @@
|
|
1
1
|
.gem-c-layout-for-public {
|
2
|
-
margin: 0;
|
3
2
|
font-family: $govuk-font-family;
|
4
3
|
}
|
4
|
+
|
5
|
+
.gem-c-layout-for-public__blue-bar {
|
6
|
+
background: $govuk-brand-colour;
|
7
|
+
height: govuk-spacing(2);
|
8
|
+
}
|
9
|
+
|
10
|
+
.js-enabled .gem-c-layout-for-public__global-banner-wrapper {
|
11
|
+
margin-top: - govuk-spacing(2);
|
12
|
+
position: relative;
|
13
|
+
}
|
@@ -78,12 +78,14 @@
|
|
78
78
|
}
|
79
79
|
}
|
80
80
|
|
81
|
-
|
82
|
-
.gem-c-layout-
|
83
|
-
.gem-c-layout-
|
84
|
-
.gem-c-layout-
|
85
|
-
|
86
|
-
|
81
|
+
@include govuk-compatibility(govuk_template) {
|
82
|
+
.gem-c-layout-header__search.govuk-grid-column-one-third-from-desktop,
|
83
|
+
.gem-c-layout-header__logo.govuk-grid-column-one-third-from-desktop,
|
84
|
+
.gem-c-layout-header__search.govuk-grid-column-one-third,
|
85
|
+
.gem-c-layout-header__logo.govuk-grid-column-two-thirds {
|
86
|
+
padding-right: 0;
|
87
|
+
padding-left: 0;
|
88
|
+
}
|
87
89
|
}
|
88
90
|
|
89
91
|
.gem-c-layout-header__logo,
|
@@ -104,7 +106,6 @@
|
|
104
106
|
|
105
107
|
.gem-c-header__content.govuk-header__content {
|
106
108
|
width: auto;
|
107
|
-
padding-left: 0;
|
108
109
|
|
109
110
|
@include govuk-media-query($from: desktop) {
|
110
111
|
float: right;
|
@@ -9,7 +9,6 @@ $large-input-size: 50px;
|
|
9
9
|
.gem-c-search__label {
|
10
10
|
@include govuk-font($size: 19, $line-height: $input-size);
|
11
11
|
display: block;
|
12
|
-
background: govuk-colour("white");
|
13
12
|
color: $govuk-text-colour;
|
14
13
|
|
15
14
|
h1 {
|
@@ -25,6 +24,7 @@ $large-input-size: 50px;
|
|
25
24
|
padding-left: govuk-spacing(3);
|
26
25
|
z-index: 1;
|
27
26
|
color: $govuk-secondary-text-colour;
|
27
|
+
background: govuk-colour("white");
|
28
28
|
}
|
29
29
|
|
30
30
|
// match label colour with the label component colour
|
@@ -144,6 +144,10 @@ $large-input-size: 50px;
|
|
144
144
|
}
|
145
145
|
|
146
146
|
.gem-c-search--on-govuk-blue {
|
147
|
+
.gem-c-search__label {
|
148
|
+
color: govuk-colour("white");
|
149
|
+
}
|
150
|
+
|
147
151
|
.gem-c-search__input {
|
148
152
|
border-width: 0;
|
149
153
|
|
@@ -191,9 +195,19 @@ $large-input-size: 50px;
|
|
191
195
|
}
|
192
196
|
|
193
197
|
.gem-c-search--no-border {
|
198
|
+
.gem-c-search__label {
|
199
|
+
color: govuk-colour("white");
|
200
|
+
}
|
201
|
+
|
194
202
|
.gem-c-search__input[type="search"] {
|
195
203
|
border: 0;
|
196
204
|
}
|
205
|
+
|
206
|
+
.js-enabled & {
|
207
|
+
.gem-c-search__label {
|
208
|
+
color: $govuk-secondary-text-colour;
|
209
|
+
}
|
210
|
+
}
|
197
211
|
}
|
198
212
|
|
199
213
|
.gem-c-search--large {
|
@@ -1,10 +1,33 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
html_lang ||= "en"
|
2
|
+
emergency_banner ||= nil
|
4
3
|
full_width ||= false
|
4
|
+
global_bar ||= nil
|
5
|
+
html_lang ||= "en"
|
6
|
+
layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
|
7
|
+
navigation_items ||= []
|
5
8
|
omit_header ||= false
|
6
9
|
show_search = local_assigns.include?(:show_search) ? local_assigns[:show_search] : true
|
7
|
-
|
10
|
+
title ||= "GOV.UK - The best place to find government services and information"
|
11
|
+
|
12
|
+
# This is a hack - but it's the only way I can find to not have two blue bars on
|
13
|
+
# constrained width layouts.
|
14
|
+
#
|
15
|
+
# The full width layout hides the blue bar underneath the blar header bar - so
|
16
|
+
# full width pages won't see the blue bar unless it's added by another component
|
17
|
+
# - and for most pages that component is the global banner.
|
18
|
+
#
|
19
|
+
# The constrained width layout doesn't hide the blue bar - so having the global
|
20
|
+
# banner on a constrained width layout means there are two blue bars.
|
21
|
+
#
|
22
|
+
# The global banner is shown with JavaScript, so users without JavaScript won't
|
23
|
+
# see it. So the constrained width blue bar can't be turned off as then it'll be
|
24
|
+
# off for everyone.
|
25
|
+
#
|
26
|
+
# This booleon adds a CSS class that shifts the banners up by the blue bar's
|
27
|
+
# height, making the two blue bars overlap and appear as one. The class is added
|
28
|
+
# when a) there's content for the emergency or global banner *and* b) when using
|
29
|
+
# the contrained width layout.
|
30
|
+
blue_bar_dedupe = !full_width && global_bar.present?
|
8
31
|
-%>
|
9
32
|
<!DOCTYPE html>
|
10
33
|
<!--[if lt IE 9]><html class="lte-ie8" lang="<%= html_lang %>"><![endif]-->
|
@@ -48,13 +71,31 @@
|
|
48
71
|
<% unless omit_header %>
|
49
72
|
<%= render "govuk_publishing_components/components/layout_header", {
|
50
73
|
search: show_search,
|
51
|
-
|
52
|
-
|
74
|
+
navigation_items: navigation_items,
|
75
|
+
|
76
|
+
# The (blue) bottom border needs to be underneath the emergency banner -
|
77
|
+
# so it has been turned off and added in manually.
|
78
|
+
remove_bottom_border: true,
|
53
79
|
} %>
|
54
80
|
<% end %>
|
55
|
-
|
81
|
+
|
82
|
+
<%= raw(emergency_banner) %>
|
83
|
+
|
84
|
+
<% unless full_width %>
|
85
|
+
<div class="gem-c-layout-for-public__blue-bar govuk-width-container"></div>
|
86
|
+
<% end %>
|
87
|
+
|
88
|
+
<% if global_bar.present? %>
|
89
|
+
<%= content_tag("div", {
|
90
|
+
class: blue_bar_dedupe ? "gem-c-layout-for-public__global-banner-wrapper" : nil,
|
91
|
+
}) do %>
|
92
|
+
<%= raw(global_bar) %>
|
93
|
+
<% end %>
|
94
|
+
<% end %>
|
95
|
+
|
96
|
+
<div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
|
56
97
|
<%= yield :before_content %>
|
57
|
-
<main class="govuk-main-wrapper">
|
98
|
+
<main class="govuk-main-wrapper" id="content">
|
58
99
|
<%= yield %>
|
59
100
|
</main>
|
60
101
|
</div>
|
@@ -1,16 +1,15 @@
|
|
1
1
|
<%
|
2
|
-
product_name ||= nil
|
3
2
|
environment ||= nil
|
4
3
|
full_width ||= false
|
5
|
-
search ||= false
|
6
|
-
search_left ||= false
|
7
|
-
navigation_items ||= []
|
8
4
|
navigation_aria_label ||= "Top level"
|
5
|
+
navigation_items ||= []
|
6
|
+
product_name ||= nil
|
9
7
|
remove_bottom_border ||= false
|
8
|
+
search ||= false
|
10
9
|
search_left ||= false
|
11
10
|
width_class = full_width ? "govuk-header__container--full-width" : "govuk-width-container"
|
12
11
|
|
13
|
-
header_classes = %w
|
12
|
+
header_classes = %w[gem-c-layout-header govuk-header]
|
14
13
|
header_classes << "gem-c-layout-header--#{environment}" if environment
|
15
14
|
header_classes << "gem-c-layout-header--no-bottom-border" if remove_bottom_border
|
16
15
|
header_classes << "gem-c-layout-header--search-left" if search_left
|
@@ -28,18 +27,22 @@
|
|
28
27
|
<div class="govuk-grid-column-full govuk-grid-column-one-third-from-desktop gem-c-layout-header__search">
|
29
28
|
<%= render "govuk_publishing_components/components/layout_header/search" %>
|
30
29
|
</div>
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
<% if navigation_items.any? %>
|
31
|
+
<div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
|
32
|
+
<%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
34
35
|
</div>
|
35
36
|
<% else %>
|
36
|
-
<div class="govuk-grid-row
|
37
|
+
<div class="govuk-grid-row">
|
37
38
|
<div class="gem-c-layout-header__logo govuk-grid-column-two-thirds">
|
38
39
|
<%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
|
39
40
|
</div>
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
<% if navigation_items.any? %>
|
42
|
+
<div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
|
43
|
+
<%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
43
46
|
<% if search %>
|
44
47
|
<div class="govuk-grid-column-one-third gem-c-layout-header__search">
|
45
48
|
<%= render "govuk_publishing_components/components/layout_header/search" %>
|
@@ -155,6 +155,7 @@ examples:
|
|
155
155
|
content_item:
|
156
156
|
title: "Transport news story"
|
157
157
|
content_id: "3c402d90-fe77-49b9-a8aa-1800d4fc2b3d"
|
158
|
+
locale: "en"
|
158
159
|
links:
|
159
160
|
ordered_related_items:
|
160
161
|
- title: Find an apprenticeship
|
@@ -180,6 +181,7 @@ examples:
|
|
180
181
|
content_item:
|
181
182
|
title: "30 creative teams awarded up to £100,000 each for Festival UK* 2022 R&D project"
|
182
183
|
content_id: "c3752802-f091-43a9-ba90-33568fccf391"
|
184
|
+
locale: "en"
|
183
185
|
links:
|
184
186
|
ordered_related_items:
|
185
187
|
- title: Find an apprenticeship
|
@@ -205,6 +207,7 @@ examples:
|
|
205
207
|
content_item:
|
206
208
|
title: "Local transport news story"
|
207
209
|
content_id: "5c82db20-7631-11e4-a3cb-005056011aef"
|
210
|
+
locale: "en"
|
208
211
|
links:
|
209
212
|
ordered_related_items:
|
210
213
|
- title: Find an apprenticeship
|
@@ -27,3 +27,29 @@ examples:
|
|
27
27
|
description: This allows the header to be omitted which is currently used when rendering CSV previews from Whitehall
|
28
28
|
data:
|
29
29
|
omit_header: true
|
30
|
+
navigation:
|
31
|
+
description: Passes the navigation through to the [header component](/component-guide/layout_header/).
|
32
|
+
data:
|
33
|
+
show_search: false
|
34
|
+
navigation_items:
|
35
|
+
- text: Navigation item 1
|
36
|
+
href: "item-1"
|
37
|
+
active: true
|
38
|
+
- text: Navigation item 2
|
39
|
+
href: "item-2"
|
40
|
+
- text: Hidden on desktop
|
41
|
+
href: "item-3"
|
42
|
+
show_only_in_collapsed_menu: true
|
43
|
+
with_global_banner:
|
44
|
+
description: This allows the HTML for the global banner to be added to the page. This is only the slot for the global banner - the markup for the banner needs to be passed in.
|
45
|
+
data:
|
46
|
+
global_bar: <div class="govuk-!-padding-top-5 govuk-!-padding-bottom-3">This is the global bar slot</div>
|
47
|
+
with_emergency_banner:
|
48
|
+
description: This allows the HTML for the emergency banner to be added to the page in the correct place. This is only the slot for the emergency banner - the markup for the banner needs to be passed in.
|
49
|
+
data:
|
50
|
+
emergency_banner: <div class="govuk-!-padding-top-3 govuk-!-padding-bottom-3">This is the emergency banner slot</div>
|
51
|
+
with_global_and_emergency_banner:
|
52
|
+
description: Both global banner and emergency banner should be usable together.
|
53
|
+
data:
|
54
|
+
emergency_banner: <div class="govuk-!-padding-top-3 govuk-!-padding-bottom-3">This is the emergency banner slot</div>
|
55
|
+
global_bar: <div class="govuk-!-padding-top-5 govuk-!-padding-bottom-3">This is the global bar slot</div>
|
data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
<% navigation_aria_label ||= "Top level" %>
|
2
2
|
|
3
3
|
<% if navigation_items.any? %>
|
4
|
-
<button
|
4
|
+
<button
|
5
|
+
aria-controls="navigation"
|
6
|
+
aria-label="Show or hide Top Level Navigation"
|
7
|
+
class="govuk-header__menu-button govuk-js-header-toggle gem-c-header__menu-button"
|
8
|
+
type="button"
|
9
|
+
>
|
10
|
+
Menu
|
11
|
+
</button>
|
5
12
|
<%= tag.nav class: "gem-c-header__nav", aria: { label: navigation_aria_label } do %>
|
6
13
|
<ul id="navigation" class="govuk-header__navigation govuk-header__navigation--end">
|
7
14
|
<% navigation_items.each_with_index do |item, index| %>
|
@@ -249,6 +249,10 @@ module GovukPublishingComponents
|
|
249
249
|
false
|
250
250
|
end
|
251
251
|
|
252
|
+
def brexit_cta_lang_allow_list?
|
253
|
+
%w[en cy].include?(content_item["locale"])
|
254
|
+
end
|
255
|
+
|
252
256
|
def parent_taxon_include?(taxon, taxon_list)
|
253
257
|
if taxon.present?
|
254
258
|
if taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| taxon_list.include?(taxon_item["content_id"]) }
|
@@ -294,6 +298,7 @@ module GovukPublishingComponents
|
|
294
298
|
|
295
299
|
def show_brexit_cta?
|
296
300
|
brexit_cta_taxon_allow_list? &&
|
301
|
+
brexit_cta_lang_allow_list? &&
|
297
302
|
step_by_step_count.zero? &&
|
298
303
|
!brexit_cta_exception?
|
299
304
|
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: 24.
|
4
|
+
version: 24.7.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: 2021-03-
|
11
|
+
date: 2021-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 3.
|
173
|
+
version: 3.7.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 3.
|
180
|
+
version: 3.7.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: jasmine_selenium_runner
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
229
|
+
version: '5.0'
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
236
|
+
version: '5.0'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: rubocop-govuk
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|