ccs-frontend_helpers 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +36 -34
- data/README.md +2 -0
- data/bun.lock +5 -5
- data/lib/ccs/components/govuk/footer.rb +7 -1
- data/lib/ccs/components/govuk/header.rb +7 -24
- data/lib/ccs/components/govuk/logo.rb +129 -0
- data/lib/ccs/components/govuk/service_navigation/navigation.rb +10 -5
- data/lib/ccs/components/govuk/service_navigation.rb +2 -1
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- data/package.json +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 593b6d07f7d3f0c574d1bd1724339aa500d209a56638ded2d920e310ba63ebab
|
4
|
+
data.tar.gz: 4081270db4b8813e7bae32732c119416eb1bd005ad3236c2dcb7fed1930fbd64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c182ff9293312d0daf639452012b70e33019164716980787510269bce4ec600ff84d81777995d33ec3f50217f4fe92e527cdb81cb917a71f002f7d1083f7de4
|
7
|
+
data.tar.gz: 8a0cae10f0ec8faad8773e91449c53dae0e91612aaac226ee2e70a8c556a4e63bb457becfcf14586781b082fb0a1a823bc69c9fc989db03fe1b5b203443708e3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.3
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [2.5.0] - 2025-06-30
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Updated GOV.UK Frontend to v5.11.0
|
15
|
+
|
16
|
+
## [2.4.0] - 2025-05-13
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
- Updated GOV.UK Frontend to v5.10.0
|
21
|
+
- Updated CCS Frontend to v1.4.1
|
22
|
+
|
10
23
|
## [2.3.0] - 2025-04-17
|
11
24
|
|
12
25
|
### Added
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gemspec
|
|
7
7
|
|
8
8
|
# Gems for building the package
|
9
9
|
gem 'bundler', '~> 2.3'
|
10
|
-
gem 'rake', '~> 13.
|
10
|
+
gem 'rake', '~> 13.3'
|
11
11
|
|
12
12
|
# Gems for testing the package
|
13
13
|
gem 'capybara', '~> 3.40.0'
|
@@ -16,11 +16,11 @@ gem 'simplecov', '~> 0.21'
|
|
16
16
|
gem 'nokogiri-diff', '~> 0.3.0'
|
17
17
|
|
18
18
|
# Gems for linting/formatting the package
|
19
|
-
gem 'rubocop', '~> 1.
|
19
|
+
gem 'rubocop', '~> 1.77'
|
20
20
|
gem 'rubocop-capybara', '~> 2.22'
|
21
|
-
gem 'rubocop-rails', '~> 2.
|
21
|
+
gem 'rubocop-rails', '~> 2.32'
|
22
22
|
gem 'rubocop-rake', '~> 0.7'
|
23
|
-
gem 'rubocop-rspec', '~> 3.
|
23
|
+
gem 'rubocop-rspec', '~> 3.6'
|
24
24
|
|
25
25
|
# Gems for documenting the package
|
26
26
|
gem 'yard', '~> 0.9'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ccs-frontend_helpers (2.
|
4
|
+
ccs-frontend_helpers (2.5.0)
|
5
5
|
rails (>= 7.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -95,10 +95,10 @@ GEM
|
|
95
95
|
regexp_parser (>= 1.5, < 3.0)
|
96
96
|
xpath (~> 3.2)
|
97
97
|
concurrent-ruby (1.3.5)
|
98
|
-
connection_pool (2.5.
|
98
|
+
connection_pool (2.5.3)
|
99
99
|
crass (1.0.6)
|
100
|
-
date (3.
|
101
|
-
diff-lcs (1.
|
100
|
+
date (3.4.1)
|
101
|
+
diff-lcs (1.6.2)
|
102
102
|
docile (1.4.0)
|
103
103
|
drb (2.2.1)
|
104
104
|
erubi (1.13.0)
|
@@ -110,11 +110,11 @@ GEM
|
|
110
110
|
irb (1.14.0)
|
111
111
|
rdoc (>= 4.0.0)
|
112
112
|
reline (>= 0.4.2)
|
113
|
-
json (2.
|
114
|
-
language_server-protocol (3.17.0.
|
113
|
+
json (2.12.2)
|
114
|
+
language_server-protocol (3.17.0.5)
|
115
115
|
lint_roller (1.1.0)
|
116
116
|
logger (1.7.0)
|
117
|
-
loofah (2.
|
117
|
+
loofah (2.24.1)
|
118
118
|
crass (~> 1.0.2)
|
119
119
|
nokogiri (>= 1.12.0)
|
120
120
|
mail (2.8.1)
|
@@ -126,7 +126,7 @@ GEM
|
|
126
126
|
matrix (0.4.2)
|
127
127
|
mini_mime (1.1.5)
|
128
128
|
minitest (5.25.5)
|
129
|
-
net-imap (0.4.
|
129
|
+
net-imap (0.4.20)
|
130
130
|
date
|
131
131
|
net-protocol
|
132
132
|
net-pop (0.1.2)
|
@@ -136,15 +136,15 @@ GEM
|
|
136
136
|
net-smtp (0.5.0)
|
137
137
|
net-protocol
|
138
138
|
nio4r (2.7.3)
|
139
|
-
nokogiri (1.18.
|
139
|
+
nokogiri (1.18.8-x86_64-darwin)
|
140
140
|
racc (~> 1.4)
|
141
|
-
nokogiri (1.18.
|
141
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
142
142
|
racc (~> 1.4)
|
143
143
|
nokogiri-diff (0.3.0)
|
144
144
|
nokogiri (~> 1.5)
|
145
145
|
tdiff (~> 0.4)
|
146
|
-
parallel (1.
|
147
|
-
parser (3.3.
|
146
|
+
parallel (1.27.0)
|
147
|
+
parser (3.3.8.0)
|
148
148
|
ast (~> 2.4.1)
|
149
149
|
racc
|
150
150
|
prism (1.4.0)
|
@@ -152,8 +152,9 @@ GEM
|
|
152
152
|
stringio
|
153
153
|
public_suffix (5.0.4)
|
154
154
|
racc (1.8.1)
|
155
|
-
rack (3.1.
|
156
|
-
rack-session (2.
|
155
|
+
rack (3.1.16)
|
156
|
+
rack-session (2.1.1)
|
157
|
+
base64 (>= 0.1.0)
|
157
158
|
rack (>= 3.0.0)
|
158
159
|
rack-test (2.1.0)
|
159
160
|
rack (>= 1.3)
|
@@ -178,9 +179,9 @@ GEM
|
|
178
179
|
activesupport (>= 5.0.0)
|
179
180
|
minitest
|
180
181
|
nokogiri (>= 1.6)
|
181
|
-
rails-html-sanitizer (1.6.
|
182
|
+
rails-html-sanitizer (1.6.1)
|
182
183
|
loofah (~> 2.21)
|
183
|
-
nokogiri (
|
184
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
184
185
|
railties (8.0.2)
|
185
186
|
actionpack (= 8.0.2)
|
186
187
|
activesupport (= 8.0.2)
|
@@ -190,26 +191,26 @@ GEM
|
|
190
191
|
thor (~> 1.0, >= 1.2.2)
|
191
192
|
zeitwerk (~> 2.6)
|
192
193
|
rainbow (3.1.1)
|
193
|
-
rake (13.
|
194
|
+
rake (13.3.0)
|
194
195
|
rdoc (6.7.0)
|
195
196
|
psych (>= 4.0.0)
|
196
197
|
regexp_parser (2.10.0)
|
197
198
|
reline (0.5.9)
|
198
199
|
io-console (~> 0.5)
|
199
|
-
rspec (3.13.
|
200
|
+
rspec (3.13.1)
|
200
201
|
rspec-core (~> 3.13.0)
|
201
202
|
rspec-expectations (~> 3.13.0)
|
202
203
|
rspec-mocks (~> 3.13.0)
|
203
|
-
rspec-core (3.13.
|
204
|
+
rspec-core (3.13.4)
|
204
205
|
rspec-support (~> 3.13.0)
|
205
|
-
rspec-expectations (3.13.
|
206
|
+
rspec-expectations (3.13.5)
|
206
207
|
diff-lcs (>= 1.2.0, < 2.0)
|
207
208
|
rspec-support (~> 3.13.0)
|
208
|
-
rspec-mocks (3.13.
|
209
|
+
rspec-mocks (3.13.5)
|
209
210
|
diff-lcs (>= 1.2.0, < 2.0)
|
210
211
|
rspec-support (~> 3.13.0)
|
211
|
-
rspec-support (3.13.
|
212
|
-
rubocop (1.
|
212
|
+
rspec-support (3.13.4)
|
213
|
+
rubocop (1.77.0)
|
213
214
|
json (~> 2.3)
|
214
215
|
language_server-protocol (~> 3.17.0.2)
|
215
216
|
lint_roller (~> 1.1.0)
|
@@ -217,25 +218,25 @@ GEM
|
|
217
218
|
parser (>= 3.3.0.2)
|
218
219
|
rainbow (>= 2.2.2, < 4.0)
|
219
220
|
regexp_parser (>= 2.9.3, < 3.0)
|
220
|
-
rubocop-ast (>= 1.
|
221
|
+
rubocop-ast (>= 1.45.1, < 2.0)
|
221
222
|
ruby-progressbar (~> 1.7)
|
222
223
|
unicode-display_width (>= 2.4.0, < 4.0)
|
223
|
-
rubocop-ast (1.
|
224
|
+
rubocop-ast (1.45.1)
|
224
225
|
parser (>= 3.3.7.2)
|
225
226
|
prism (~> 1.4)
|
226
227
|
rubocop-capybara (2.22.1)
|
227
228
|
lint_roller (~> 1.1)
|
228
229
|
rubocop (~> 1.72, >= 1.72.1)
|
229
|
-
rubocop-rails (2.
|
230
|
+
rubocop-rails (2.32.0)
|
230
231
|
activesupport (>= 4.2.0)
|
231
232
|
lint_roller (~> 1.1)
|
232
233
|
rack (>= 1.1)
|
233
234
|
rubocop (>= 1.75.0, < 2.0)
|
234
|
-
rubocop-ast (>= 1.
|
235
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
235
236
|
rubocop-rake (0.7.1)
|
236
237
|
lint_roller (~> 1.1)
|
237
238
|
rubocop (>= 1.72.1)
|
238
|
-
rubocop-rspec (3.
|
239
|
+
rubocop-rspec (3.6.0)
|
239
240
|
lint_roller (~> 1.1)
|
240
241
|
rubocop (~> 1.72, >= 1.72.1)
|
241
242
|
ruby-progressbar (1.13.0)
|
@@ -249,7 +250,7 @@ GEM
|
|
249
250
|
stringio (3.1.1)
|
250
251
|
tdiff (0.4.0)
|
251
252
|
thor (1.3.2)
|
252
|
-
timeout (0.4.
|
253
|
+
timeout (0.4.3)
|
253
254
|
tzinfo (2.0.6)
|
254
255
|
concurrent-ruby (~> 1.0)
|
255
256
|
unicode-display_width (3.1.4)
|
@@ -257,7 +258,7 @@ GEM
|
|
257
258
|
unicode-emoji (4.0.4)
|
258
259
|
uri (1.0.3)
|
259
260
|
useragent (0.16.11)
|
260
|
-
webrick (1.8.
|
261
|
+
webrick (1.8.2)
|
261
262
|
websocket-driver (0.7.6)
|
262
263
|
websocket-extensions (>= 0.1.0)
|
263
264
|
websocket-extensions (0.1.5)
|
@@ -271,6 +272,7 @@ PLATFORMS
|
|
271
272
|
x86_64-darwin-20
|
272
273
|
x86_64-darwin-22
|
273
274
|
x86_64-darwin-23
|
275
|
+
x86_64-darwin-24
|
274
276
|
x86_64-linux
|
275
277
|
|
276
278
|
DEPENDENCIES
|
@@ -278,13 +280,13 @@ DEPENDENCIES
|
|
278
280
|
capybara (~> 3.40.0)
|
279
281
|
ccs-frontend_helpers!
|
280
282
|
nokogiri-diff (~> 0.3.0)
|
281
|
-
rake (~> 13.
|
283
|
+
rake (~> 13.3)
|
282
284
|
rspec (~> 3.13)
|
283
|
-
rubocop (~> 1.
|
285
|
+
rubocop (~> 1.77)
|
284
286
|
rubocop-capybara (~> 2.22)
|
285
|
-
rubocop-rails (~> 2.
|
287
|
+
rubocop-rails (~> 2.32)
|
286
288
|
rubocop-rake (~> 0.7)
|
287
|
-
rubocop-rspec (~> 3.
|
289
|
+
rubocop-rspec (~> 3.6)
|
288
290
|
simplecov (~> 0.21)
|
289
291
|
yard (~> 0.9)
|
290
292
|
|
data/README.md
CHANGED
@@ -14,6 +14,8 @@ The following table shows the version of CCS Frontend Helpers that you should us
|
|
14
14
|
|
15
15
|
| CCS Frontend Helpers Version | Target GOV.UK Frontend Version | Target CCS Frontend Version |
|
16
16
|
| ----------------------------- | ------------------------------ | --------------------------- |
|
17
|
+
| [2.5.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.5.0) | [5.11.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.11.0) | [1.4.1](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.4.1) |
|
18
|
+
| [2.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.4.0) | [5.10.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.10.0) | [1.4.1](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.4.1) |
|
17
19
|
| [2.3.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.3.0) | [5.9.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.9.0) | [1.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.4.0) |
|
18
20
|
| [2.2.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.2.0) | [5.9.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.9.0) | [1.3.3](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.3.3) |
|
19
21
|
| [2.1.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.1.0) | [5.7.1](https://github.com/alphagov/govuk-frontend/releases/tag/v5.7.1) | [1.3.2](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.3.2) |
|
data/bun.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
{
|
2
|
-
"lockfileVersion":
|
2
|
+
"lockfileVersion": 1,
|
3
3
|
"workspaces": {
|
4
4
|
"": {
|
5
5
|
"devDependencies": {
|
6
|
-
"ccs-frontend": "^1.4.
|
7
|
-
"govuk-frontend": "^5.
|
6
|
+
"ccs-frontend": "^1.4.1",
|
7
|
+
"govuk-frontend": "^5.11.0",
|
8
8
|
},
|
9
9
|
},
|
10
10
|
},
|
11
11
|
"packages": {
|
12
|
-
"ccs-frontend": ["ccs-frontend@1.4.
|
12
|
+
"ccs-frontend": ["ccs-frontend@1.4.1", "", { "peerDependencies": { "govuk-frontend": "^5.10.0", "jquery": "^3.x" } }, "sha512-dLg0GgJicg+OsGzCofjckYhht8zhD+A/qS6hkJgGg5amIQ2m4WDU+sB4p7CkOX/mooqil8MDdIdcRwtXoydzRw=="],
|
13
13
|
|
14
|
-
"govuk-frontend": ["govuk-frontend@5.
|
14
|
+
"govuk-frontend": ["govuk-frontend@5.11.0", "", {}, "sha512-RYZDEF1J6nVw5XauQGH+91qplExgHUXfXII7dtIme6I4u3eSvU59yZ0/EFKEwRgTslSqlhJODOnAi5rnQFU5Gw=="],
|
15
15
|
|
16
16
|
"jquery": ["jquery@3.7.1", "", {}, "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="],
|
17
17
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative '../base'
|
2
2
|
require_relative 'footer/navigation'
|
3
3
|
require_relative 'footer/meta'
|
4
|
+
require_relative 'logo'
|
4
5
|
|
5
6
|
module CCS
|
6
7
|
module Components
|
@@ -14,11 +15,13 @@ module CCS
|
|
14
15
|
# @return [Array<Navigation>] An array of the initialised navigation sections
|
15
16
|
# @!attribute [r] meta
|
16
17
|
# @return [Meta] The initialised meta section
|
18
|
+
# @!attribute [r] logo
|
19
|
+
# @return [Logo] The initialised logo component
|
17
20
|
|
18
21
|
class Footer < Base
|
19
22
|
private
|
20
23
|
|
21
|
-
attr_reader :navigation, :meta
|
24
|
+
attr_reader :navigation, :meta, :logo
|
22
25
|
|
23
26
|
public
|
24
27
|
|
@@ -32,6 +35,7 @@ module CCS
|
|
32
35
|
# @option options [String] :container_class classes that can be added to the inner container
|
33
36
|
# @option options [ActiveSupport::SafeBuffer,String] :content_licence The content licence information, see {CCS::Components::GovUK::Footer#footer_content_licence footer_content_licence} for default
|
34
37
|
# @option options [ActiveSupport::SafeBuffer,String] :copyright The copyright information, (default: '© Crown copyright')
|
38
|
+
# @option options [Boolean] :rebrand flag to use the rebrand footer which includes the logo
|
35
39
|
# @option options [Hash] :attributes additional attributes that will added as part of the HTML
|
36
40
|
|
37
41
|
def initialize(navigation: nil, meta: nil, **)
|
@@ -39,6 +43,7 @@ module CCS
|
|
39
43
|
|
40
44
|
@options[:copyright] ||= '© Crown copyright'
|
41
45
|
|
46
|
+
@logo = Logo.new(rebrand: true, use_logotype: false, classes: 'govuk-footer__crown', context: @context) if @options[:rebrand]
|
42
47
|
@navigation = navigation&.map { |navigation_item| Navigation.new(context: @context, **navigation_item) }
|
43
48
|
@meta = Meta.new(context: @context, **meta) if meta
|
44
49
|
end
|
@@ -52,6 +57,7 @@ module CCS
|
|
52
57
|
def render
|
53
58
|
tag.footer(**options[:attributes]) do
|
54
59
|
tag.div(class: "govuk-width-container #{options[:container_classes]}".rstrip) do
|
60
|
+
concat(logo.render) if logo
|
55
61
|
if navigation.present?
|
56
62
|
concat(tag.div(class: 'govuk-footer__navigation') do
|
57
63
|
navigation.each { |navigation_item| concat(navigation_item.render) }
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative '../base'
|
2
2
|
require_relative 'header/navigation'
|
3
|
+
require_relative 'logo'
|
3
4
|
|
4
5
|
module CCS
|
5
6
|
module Components
|
@@ -13,11 +14,13 @@ module CCS
|
|
13
14
|
# @return [Navigation] The initialised navigation section
|
14
15
|
# @!attribute [r] service
|
15
16
|
# @return [Hash] The options for the service section
|
17
|
+
# @!attribute [r] logo
|
18
|
+
# @return [Logo] The initialised logo component
|
16
19
|
|
17
20
|
class Header < Base
|
18
21
|
private
|
19
22
|
|
20
|
-
attr_reader :navigation, :service
|
23
|
+
attr_reader :navigation, :service, :logo
|
21
24
|
|
22
25
|
public
|
23
26
|
|
@@ -36,6 +39,7 @@ module CCS
|
|
36
39
|
# @option options [String] :homepage_url URL of the homepage. Defaults to +/+
|
37
40
|
# @option options [String] :product_name product name, used when the product name follows on directly from ‘GOV.UK
|
38
41
|
# @option options [Boolean] :use_tudor_crown flag to use the new tudor crown for the GOV.UK Logo
|
42
|
+
# @option options [Boolean] :rebrand flag to use the rebrand logo
|
39
43
|
# @option options [Hash] :attributes additional attributes that will added as part of the header HTML
|
40
44
|
|
41
45
|
def initialize(navigation: nil, menu_button: nil, service: nil, **)
|
@@ -45,6 +49,7 @@ module CCS
|
|
45
49
|
@options[:homepage_url] ||= '/'
|
46
50
|
@options[:use_tudor_crown] = true if @options[:use_tudor_crown].nil?
|
47
51
|
|
52
|
+
@logo = Logo.new(rebrand: @options[:rebrand], use_tudor_crown: @options[:use_tudor_crown], classes: 'govuk-header__logotype', attributes: { aria: { label: 'GOV.UK' } }, context: @context)
|
48
53
|
@navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items].present?
|
49
54
|
@service = service
|
50
55
|
end
|
@@ -80,7 +85,7 @@ module CCS
|
|
80
85
|
def header_logo
|
81
86
|
tag.div(class: 'govuk-header__logo') do
|
82
87
|
link_to(options[:homepage_url], class: 'govuk-header__link govuk-header__link--homepage') do
|
83
|
-
concat(
|
88
|
+
concat(logo.render)
|
84
89
|
concat(tag.span(options[:product_name], class: 'govuk-header__product-name')) if options[:product_name]
|
85
90
|
end
|
86
91
|
end
|
@@ -97,28 +102,6 @@ module CCS
|
|
97
102
|
tag.span(service[:name], class: 'govuk-header__service-name')
|
98
103
|
end
|
99
104
|
end
|
100
|
-
|
101
|
-
# Generates the GOV.UK log with St. Edwards Crown
|
102
|
-
#
|
103
|
-
# @return [ActiveSupport::SafeBuffer]
|
104
|
-
|
105
|
-
def st_edwards_crown
|
106
|
-
tag.svg(class: 'govuk-header__logotype', xmlns: 'http://www.w3.org/2000/svg', height: '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4.1v13.6c0 1.2-.2 2.2-.6 3.1s-1 1.7-1.8 2.4c-.7.7-1.6 1.2-2.7 1.5-1 .4-2.2.5-3.4.5-1.2 0-2.4-.2-3.4-.5-1-.4-1.9-.9-2.7-1.5-.8-.7-1.3-1.5-1.8-2.4-.4-.9-.6-2-.6-3.1V6.9h4.2v13c0 .8.1 1.4.3 2 .2.6.5 1 .9 1.4.4.4.8.6 1.4.8.6.2 1.1.3 1.8.3zm13-17.4h4.2v9.1l7.4-9.1h5.2l-7.2 8.4L152 28h-4.9l-5.5-9.4-2.7 3V28h-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z'))
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# Generates the GOV.UK logo with a Tudor Crown
|
113
|
-
#
|
114
|
-
# @return [ActiveSupport::SafeBuffer]
|
115
|
-
|
116
|
-
def tudor_crown
|
117
|
-
tag.svg(class: 'govuk-header__logotype', xmlns: 'http://www.w3.org/2000/svg', height: '30', width: '148', aria: { label: 'GOV.UK' }, focusable: 'false', viewBox: '0 0 148 30', role: 'img') do
|
118
|
-
concat(tag.title('GOV.UK'))
|
119
|
-
concat(tag.path(d: 'M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2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 1.7-1.4c.5-.6.8-1.3 1.1-2.2.2-.8.4-1.7.4-2.7v-.1c0-1-.1-1.9-.4-2.7-.2-.8-.6-1.6-1.1-2.2-.5-.6-1.1-1.1-1.7-1.4-.7-.3-1.5-.5-2.4-.5s-1.7.2-2.4.5-1.3.8-1.7 1.4c-.5.6-.8 1.3-1.1 2.2-.2.8-.4 1.7-.4 2.7v.1c0 1 .1 1.9.4 2.7.2.8.6 1.6 1.1 2.2.5.6 1.1 1.1 1.7 1.4.6.3 1.4.5 2.4.5zM88.9 28 83 7h4.7l4 15.7h.1l4-15.7h4.7l-5.9 21h-5.7zm28.8-3.6c.6 0 1.2-.1 1.7-.3.5-.2 1-.4 1.4-.8.4-.4.7-.8.9-1.4.2-.6.3-1.2.3-2v-13h4.1v13.6c0 1.2-.2 2.2-.6 3.1s-1 1.7-1.8 2.4c-.7.7-1.6 1.2-2.7 1.5-1 .4-2.2.5-3.4.5-1.2 0-2.4-.2-3.4-.5-1-.4-1.9-.9-2.7-1.5-.8-.7-1.3-1.5-1.8-2.4-.4-.9-.6-2-.6-3.1V6.9h4.2v13c0 .8.1 1.4.3 2 .2.6.5 1 .9 1.4.4.4.8.6 1.4.8.6.2 1.1.3 1.8.3zm13-17.4h4.2v9.1l7.4-9.1h5.2l-7.2 8.4L148 28h-4.9l-5.5-9.4-2.7 3V28h-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z'))
|
120
|
-
end
|
121
|
-
end
|
122
105
|
end
|
123
106
|
end
|
124
107
|
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require_relative '../base'
|
2
|
+
|
3
|
+
module CCS
|
4
|
+
module Components
|
5
|
+
module GovUK
|
6
|
+
# = GOV.UK Logo
|
7
|
+
#
|
8
|
+
# This is used to generate the logo component from the
|
9
|
+
# {https://github.com/alphagov/govuk-frontend/blob/main/packages/govuk-frontend/src/govuk/macros/logo.njk GDS - Macros - Logo}
|
10
|
+
#
|
11
|
+
# @!attribute [r] rebrand
|
12
|
+
# @return [Boolean] flag for rebrand
|
13
|
+
# @!attribute [r] use_logotype
|
14
|
+
# @return [Boolean] flag for logotype
|
15
|
+
# @!attribute [r] use_tudor_crown
|
16
|
+
# @return [Boolean] flag for tudor crown
|
17
|
+
|
18
|
+
class Logo < Base
|
19
|
+
include ActionView::Context
|
20
|
+
include ActionView::Helpers
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :rebrand, :use_logotype, :use_tudor_crown
|
25
|
+
|
26
|
+
public
|
27
|
+
|
28
|
+
# @param rebrand [Boolean] Flag for rebrand
|
29
|
+
# @param use_logotype [Boolean] Flag for logotyp
|
30
|
+
# @param use_tudor_crown [Boolean] Flag for tudor crown
|
31
|
+
# @param options [Hash] options that will be used in customising the HTML
|
32
|
+
#
|
33
|
+
# @option options [String] :classes additional CSS classes for the logo HTML
|
34
|
+
# @option options [Hash] :attributes additional attributes that will added as part of the logo HTML
|
35
|
+
|
36
|
+
def initialize(rebrand: false, use_logotype: true, use_tudor_crown: true, **)
|
37
|
+
super(**)
|
38
|
+
|
39
|
+
@rebrand = rebrand
|
40
|
+
@use_logotype = use_logotype
|
41
|
+
@use_tudor_crown = rebrand ? true : use_tudor_crown
|
42
|
+
|
43
|
+
svg_width = @use_tudor_crown ? 32 : 36
|
44
|
+
svg_width = rebrand ? svg_width + 130 : svg_width + 116 if @use_logotype
|
45
|
+
|
46
|
+
@options[:attributes][:focusable] = 'false'
|
47
|
+
@options[:attributes][:role] = @options[:attributes].dig(:aria, :label) ? 'img' : 'presentation'
|
48
|
+
@options[:attributes][:xmlns] = 'http://www.w3.org/2000/svg'
|
49
|
+
@options[:attributes][:viewBox] = "0 0 #{svg_width * 2} 60"
|
50
|
+
@options[:attributes][:height] = '30'
|
51
|
+
@options[:attributes][:width] = svg_width.to_s
|
52
|
+
@options[:attributes][:fill] = 'currentcolor'
|
53
|
+
end
|
54
|
+
|
55
|
+
# Generates the HTML for the GOV.UK Logo component
|
56
|
+
#
|
57
|
+
# @return [ActiveSupport::SafeBuffer]
|
58
|
+
|
59
|
+
def render
|
60
|
+
tag.svg(**options[:attributes]) do
|
61
|
+
concat(tag.title(@options[:attributes].dig(:aria, :label))) if @options[:attributes].dig(:aria, :label)
|
62
|
+
concat(use_tudor_crown ? tudor_crown : st_edwards_crown)
|
63
|
+
concat(rebrand ? dot_logotype : logotype) if use_logotype
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# The default attributes for the logo
|
68
|
+
|
69
|
+
DEFAULT_ATTRIBUTES = {}.freeze
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
# Generates the St Edwards Crown HTML
|
74
|
+
#
|
75
|
+
# @return [ActiveSupport::SafeBuffer]
|
76
|
+
|
77
|
+
def st_edwards_crown
|
78
|
+
tag.path(d: 'M13.4,22.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M4.8,27.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-1,2,0,4.2,2,5M2.2,36.9c2,.8,4.2-.2,5-2,.8-2-.2-4.2-2-5-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M23,25.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2s0,4.2,2,5M57.8,22.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M66.4,27.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M69,36.9c-2,.8-4.2-.2-5-2-.8-2,.2-4.2,2-5,2-.8,4.2.2,5,2,.8,2,0,4.2-2,5M48.2,25.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2s0,4.2-2,5M37.6,15.5l4.8,2.6v-7.2l-4.8,1.6c-.2-.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|
81
|
+
# rubocop:disable Metrics/AbcSize
|
82
|
+
|
83
|
+
# Generates the Tudor Crown HTML
|
84
|
+
#
|
85
|
+
# @return [ActiveSupport::SafeBuffer]
|
86
|
+
|
87
|
+
def tudor_crown
|
88
|
+
tag.g do
|
89
|
+
concat(tag.circle(cx: '20', cy: '17.6', r: '3.7'))
|
90
|
+
concat(tag.circle(cx: '10.2', cy: '23.5', r: '3.7'))
|
91
|
+
concat(tag.circle(cx: '3.7', cy: '33.2', r: '3.7'))
|
92
|
+
concat(tag.circle(cx: '31.7', cy: '30.6', r: '3.7'))
|
93
|
+
concat(tag.circle(cx: '43.3', cy: '17.6', r: '3.7'))
|
94
|
+
concat(tag.circle(cx: '53.2', cy: '23.5', r: '3.7'))
|
95
|
+
concat(tag.circle(cx: '59.7', cy: '33.2', r: '3.7'))
|
96
|
+
concat(tag.circle(cx: '31.7', cy: '30.6', r: '3.7'))
|
97
|
+
concat(tag.path(d: 'M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z'))
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# rubocop:enable Metrics/AbcSize
|
102
|
+
|
103
|
+
# Generates the HTML for logotype with standard dot
|
104
|
+
#
|
105
|
+
# @return [ActiveSupport::SafeBuffer]
|
106
|
+
|
107
|
+
def logotype
|
108
|
+
path_kwargs = {
|
109
|
+
d: 'M88.6,33.2c0,1.8.2,3.4.6,5s1.2,3,2,4.4c1,1.2,2,2.2,3.4,3s3,1.2,5,1.2,3.4-.2,4.6-.8,2.2-1.4,3-2.2,1.2-1.8,1.6-3c.2-1,.4-2,.4-3v-.4h-10.6v-6.4h18.8v23h-7.4v-5c-.6.8-1.2,1.6-2,2.2-.8.6-1.6,1.2-2.6,1.8-1,.4-2,.8-3.2,1.2s-2.4.4-3.6.4c-3,0-5.8-.6-8-1.6-2.4-1.2-4.4-2.6-6-4.6s-2.8-4.2-3.6-6.8c-.6-2.8-1-5.6-1-8.6s.4-5.8,1.4-8.4,2.2-4.8,4-6.8,3.8-3.4,6.2-4.6c2.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27.2c0,2.4-.4,4.4-1.2,6.2s-2,3.4-3.6,4.8c-1.4,1.4-3.2,2.4-5.4,3-2,.8-4.4,1-6.8,1s-4.8-.4-6.8-1c-2-.8-3.8-1.8-5.4-3-1.6-1.4-2.6-3-3.6-4.8-.8-1.8-1.2-4-1.2-6.2V11.7h8.4v26c0,1.6.2,2.8.6,4,.4,1.2,1,2,1.8,2.8s1.6,1.2,2.8,1.6c1.2.4,2.2.6,3.6.6h0ZM261.4,11.9h8.4v18.2l14.8-18.2h10.4l-14.4,16.8,15.4,25.2h-9.8l-11-18.8-5.4,6v12.8h-8.4V11.9h0ZM206.2,44.2c-3,0-5.4,2.4-5.4,5.4s2.4,5.4,5.4,5.4,5.4-2.4,5.4-5.4-2.4-5.4-5.4-5.4Z'
|
110
|
+
}
|
111
|
+
path_kwargs[:transform] = 'translate(8 0)' unless use_tudor_crown
|
112
|
+
|
113
|
+
tag.path(**path_kwargs)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Generates the HTML for logotype with raised and coloured dot
|
117
|
+
#
|
118
|
+
# @return [ActiveSupport::SafeBuffer]
|
119
|
+
|
120
|
+
def dot_logotype
|
121
|
+
capture do
|
122
|
+
concat(tag.circle(class: 'govuk-logo-dot', cx: '226', cy: '36', r: '7.3'))
|
123
|
+
concat(tag.path(d: 'M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9'))
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -18,6 +18,8 @@ module CCS
|
|
18
18
|
# @return [String] The id for the navigation
|
19
19
|
# @!attribute [r] menu_button
|
20
20
|
# @return [Hash] The options for the menu button
|
21
|
+
# @!attribute [r] collapse_navigation_on_mobile
|
22
|
+
# @return [Boolean] Flag to collapse navigation on mobile
|
21
23
|
|
22
24
|
class Navigation
|
23
25
|
include ActionView::Context
|
@@ -25,15 +27,16 @@ module CCS
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
attr_reader :navigation, :menu_button
|
30
|
+
attr_reader :navigation, :menu_button, :collapse_navigation_on_mobile
|
29
31
|
|
30
32
|
public
|
31
33
|
|
32
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
34
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
33
35
|
|
34
36
|
# @param navigation [Hash] options for the navigation
|
35
37
|
# @param context [ActionView::Base] the view context
|
36
38
|
# @param menu_button [Hash] options for the menu button
|
39
|
+
# @param collapse_navigation_on_mobile [Boolean] flag to collapse navigation on mobile
|
37
40
|
#
|
38
41
|
# @option navigation [Array] :items an array of links for the navigation section.
|
39
42
|
# See {Components::GovUK::ServiceNavigation::Link#initialize Link#initialize} for details of the items in the array.
|
@@ -45,7 +48,7 @@ module CCS
|
|
45
48
|
# @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
|
46
49
|
# Defaults to +Show or hide menu+.
|
47
50
|
|
48
|
-
def initialize(navigation:, context:, menu_button: nil)
|
51
|
+
def initialize(navigation:, context:, menu_button: nil, collapse_navigation_on_mobile: nil)
|
49
52
|
menu_button ||= {}
|
50
53
|
menu_button[:text] ||= 'Menu'
|
51
54
|
|
@@ -58,9 +61,11 @@ module CCS
|
|
58
61
|
@navigation[:links] = navigation[:items].map { |navigation_link| Link.new(context: context, **navigation_link) }
|
59
62
|
@navigation[:label] = navigation[:label] || menu_button[:text]
|
60
63
|
@navigation[:class] = "govuk-service-navigation__wrapper #{navigation[:classes]}".rstrip
|
64
|
+
|
65
|
+
@collapse_navigation_on_mobile = collapse_navigation_on_mobile.nil? ? @navigation[:links].length > 1 : collapse_navigation_on_mobile
|
61
66
|
end
|
62
67
|
|
63
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
68
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
64
69
|
|
65
70
|
# Generates the HTML for the GOV.UK Service Navigation navigation
|
66
71
|
#
|
@@ -68,7 +73,7 @@ module CCS
|
|
68
73
|
|
69
74
|
def render
|
70
75
|
tag.nav(aria: { label: navigation[:label] }, class: navigation[:class]) do
|
71
|
-
concat(button_tag(menu_button[:text], type: :button, class: 'govuk-service-navigation__toggle govuk-js-service-navigation-toggle', aria: menu_button[:aria], hidden: true))
|
76
|
+
concat(button_tag(menu_button[:text], type: :button, class: 'govuk-service-navigation__toggle govuk-js-service-navigation-toggle', aria: menu_button[:aria], hidden: true)) if collapse_navigation_on_mobile
|
72
77
|
concat(tag.ul(id: navigation[:id], class: 'govuk-service-navigation__list') do
|
73
78
|
navigation[:links].each { |navigation_link| concat(navigation_link.render) }
|
74
79
|
end)
|
@@ -33,13 +33,14 @@ module CCS
|
|
33
33
|
#
|
34
34
|
# @option options [String] :classes additional CSS classes for the service navigation HTML
|
35
35
|
# @option options [Hash] :attributes additional attributes that will added as part of the service navigation HTML
|
36
|
+
# @option options [Boolean] :collapse_navigation_on_mobile flag to collapse navigation on mobile
|
36
37
|
|
37
38
|
def initialize(navigation: nil, menu_button: nil, service: nil, **)
|
38
39
|
super(**)
|
39
40
|
|
40
41
|
(@options[:attributes][:aria] ||= {})[:label] ||= 'Service information' if service
|
41
42
|
|
42
|
-
@navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items]
|
43
|
+
@navigation = Navigation.new(navigation: navigation, menu_button: menu_button, collapse_navigation_on_mobile: options[:collapse_navigation_on_mobile], context: @context) if navigation && navigation[:items]&.compact_blank!.present?
|
43
44
|
@service = service
|
44
45
|
end
|
45
46
|
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ccs-frontend_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crown Commercial Service
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/ccs/components/govuk/hint.rb
|
108
108
|
- lib/ccs/components/govuk/inset_text.rb
|
109
109
|
- lib/ccs/components/govuk/label.rb
|
110
|
+
- lib/ccs/components/govuk/logo.rb
|
110
111
|
- lib/ccs/components/govuk/notification_banner.rb
|
111
112
|
- lib/ccs/components/govuk/pagination.rb
|
112
113
|
- lib/ccs/components/govuk/pagination/increment.rb
|
@@ -223,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
224
|
- !ruby/object:Gem::Version
|
224
225
|
version: '0'
|
225
226
|
requirements: []
|
226
|
-
rubygems_version: 3.6.
|
227
|
+
rubygems_version: 3.6.7
|
227
228
|
specification_version: 4
|
228
229
|
summary: Gem containing view helpers for CCS Ruby on Rails projects
|
229
230
|
test_files: []
|