ccs-frontend_helpers 2.5.0 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 593b6d07f7d3f0c574d1bd1724339aa500d209a56638ded2d920e310ba63ebab
4
- data.tar.gz: 4081270db4b8813e7bae32732c119416eb1bd005ad3236c2dcb7fed1930fbd64
3
+ metadata.gz: f29c2f97482a7c5a87325dafb7ebb3c4bf5a450f735d03c1fb2ee56e012a9a0f
4
+ data.tar.gz: 678ebc845227fee1e88c6ad046125c2d65db86e0c34f9041d2fab6d4bf9aa0d5
5
5
  SHA512:
6
- metadata.gz: 5c182ff9293312d0daf639452012b70e33019164716980787510269bce4ec600ff84d81777995d33ec3f50217f4fe92e527cdb81cb917a71f002f7d1083f7de4
7
- data.tar.gz: 8a0cae10f0ec8faad8773e91449c53dae0e91612aaac226ee2e70a8c556a4e63bb457becfcf14586781b082fb0a1a823bc69c9fc989db03fe1b5b203443708e3
6
+ metadata.gz: 2b79e25e4801d5036904a1ed5f1a829e1b3f95ca5058927745b5590c237f6301bfd20f7249d5f4d18146d63ae23a229be07bd884b461acb101bda725cc396cf4
7
+ data.tar.gz: 02a239b6c44b74b0881ee4d0528d86a5dab668dff91ded66548a34a8ad68d5922d071bbc24853c405d35427706449bb3c7d10136a0146a887043d688ca434948
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.3
1
+ 3.4.7
data/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.1.0] - 2025-10-13
11
+
12
+ ### Added
13
+
14
+ - Updated GOV.UK Frontend to v5.13.0
15
+ - Updated CCS Frontend to v2.1.0
16
+
17
+ ## [3.0.0] - 2025-08-27
18
+
19
+ ### Added
20
+
21
+ - Updated CCS Frontend to v2.0.0
22
+
23
+ ### Removed
24
+
25
+ - The CCS Header is now just the logo as all other parts should now go in the GOV.UK Service Navigation component
26
+
10
27
  ## [2.5.0] - 2025-06-30
11
28
 
12
29
  ### Added
data/Gemfile CHANGED
@@ -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.77'
19
+ gem 'rubocop', '~> 1.81'
20
20
  gem 'rubocop-capybara', '~> 2.22'
21
- gem 'rubocop-rails', '~> 2.32'
21
+ gem 'rubocop-rails', '~> 2.33'
22
22
  gem 'rubocop-rake', '~> 0.7'
23
- gem 'rubocop-rspec', '~> 3.6'
23
+ gem 'rubocop-rspec', '~> 3.7'
24
24
 
25
25
  # Gems for documenting the package
26
26
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,35 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (2.5.0)
4
+ ccs-frontend_helpers (3.1.0)
5
5
  rails (>= 7.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (8.0.2)
11
- actionpack (= 8.0.2)
12
- activesupport (= 8.0.2)
10
+ actioncable (8.0.3)
11
+ actionpack (= 8.0.3)
12
+ activesupport (= 8.0.3)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (8.0.2)
17
- actionpack (= 8.0.2)
18
- activejob (= 8.0.2)
19
- activerecord (= 8.0.2)
20
- activestorage (= 8.0.2)
21
- activesupport (= 8.0.2)
16
+ actionmailbox (8.0.3)
17
+ actionpack (= 8.0.3)
18
+ activejob (= 8.0.3)
19
+ activerecord (= 8.0.3)
20
+ activestorage (= 8.0.3)
21
+ activesupport (= 8.0.3)
22
22
  mail (>= 2.8.0)
23
- actionmailer (8.0.2)
24
- actionpack (= 8.0.2)
25
- actionview (= 8.0.2)
26
- activejob (= 8.0.2)
27
- activesupport (= 8.0.2)
23
+ actionmailer (8.0.3)
24
+ actionpack (= 8.0.3)
25
+ actionview (= 8.0.3)
26
+ activejob (= 8.0.3)
27
+ activesupport (= 8.0.3)
28
28
  mail (>= 2.8.0)
29
29
  rails-dom-testing (~> 2.2)
30
- actionpack (8.0.2)
31
- actionview (= 8.0.2)
32
- activesupport (= 8.0.2)
30
+ actionpack (8.0.3)
31
+ actionview (= 8.0.3)
32
+ activesupport (= 8.0.3)
33
33
  nokogiri (>= 1.8.5)
34
34
  rack (>= 2.2.4)
35
35
  rack-session (>= 1.0.1)
@@ -37,35 +37,35 @@ GEM
37
37
  rails-dom-testing (~> 2.2)
38
38
  rails-html-sanitizer (~> 1.6)
39
39
  useragent (~> 0.16)
40
- actiontext (8.0.2)
41
- actionpack (= 8.0.2)
42
- activerecord (= 8.0.2)
43
- activestorage (= 8.0.2)
44
- activesupport (= 8.0.2)
40
+ actiontext (8.0.3)
41
+ actionpack (= 8.0.3)
42
+ activerecord (= 8.0.3)
43
+ activestorage (= 8.0.3)
44
+ activesupport (= 8.0.3)
45
45
  globalid (>= 0.6.0)
46
46
  nokogiri (>= 1.8.5)
47
- actionview (8.0.2)
48
- activesupport (= 8.0.2)
47
+ actionview (8.0.3)
48
+ activesupport (= 8.0.3)
49
49
  builder (~> 3.1)
50
50
  erubi (~> 1.11)
51
51
  rails-dom-testing (~> 2.2)
52
52
  rails-html-sanitizer (~> 1.6)
53
- activejob (8.0.2)
54
- activesupport (= 8.0.2)
53
+ activejob (8.0.3)
54
+ activesupport (= 8.0.3)
55
55
  globalid (>= 0.3.6)
56
- activemodel (8.0.2)
57
- activesupport (= 8.0.2)
58
- activerecord (8.0.2)
59
- activemodel (= 8.0.2)
60
- activesupport (= 8.0.2)
56
+ activemodel (8.0.3)
57
+ activesupport (= 8.0.3)
58
+ activerecord (8.0.3)
59
+ activemodel (= 8.0.3)
60
+ activesupport (= 8.0.3)
61
61
  timeout (>= 0.4.0)
62
- activestorage (8.0.2)
63
- actionpack (= 8.0.2)
64
- activejob (= 8.0.2)
65
- activerecord (= 8.0.2)
66
- activesupport (= 8.0.2)
62
+ activestorage (8.0.3)
63
+ actionpack (= 8.0.3)
64
+ activejob (= 8.0.3)
65
+ activerecord (= 8.0.3)
66
+ activesupport (= 8.0.3)
67
67
  marcel (~> 1.0)
68
- activesupport (8.0.2)
68
+ activesupport (8.0.3)
69
69
  base64
70
70
  benchmark (>= 0.3)
71
71
  bigdecimal
@@ -81,9 +81,9 @@ GEM
81
81
  addressable (2.8.6)
82
82
  public_suffix (>= 2.0.2, < 6.0)
83
83
  ast (2.4.3)
84
- base64 (0.2.0)
85
- benchmark (0.4.0)
86
- bigdecimal (3.1.9)
84
+ base64 (0.3.0)
85
+ benchmark (0.4.1)
86
+ bigdecimal (3.2.3)
87
87
  builder (3.3.0)
88
88
  capybara (3.40.0)
89
89
  addressable
@@ -95,22 +95,24 @@ 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.3)
98
+ connection_pool (2.5.4)
99
99
  crass (1.0.6)
100
100
  date (3.4.1)
101
101
  diff-lcs (1.6.2)
102
102
  docile (1.4.0)
103
- drb (2.2.1)
104
- erubi (1.13.0)
105
- globalid (1.2.1)
103
+ drb (2.2.3)
104
+ erb (5.0.2)
105
+ erubi (1.13.1)
106
+ globalid (1.3.0)
106
107
  activesupport (>= 6.1)
107
108
  i18n (1.14.7)
108
109
  concurrent-ruby (~> 1.0)
109
- io-console (0.7.2)
110
- irb (1.14.0)
110
+ io-console (0.8.1)
111
+ irb (1.15.2)
112
+ pp (>= 0.6.0)
111
113
  rdoc (>= 4.0.0)
112
114
  reline (>= 0.4.2)
113
- json (2.12.2)
115
+ json (2.15.0)
114
116
  language_server-protocol (3.17.0.5)
115
117
  lint_roller (1.1.0)
116
118
  logger (1.7.0)
@@ -122,80 +124,87 @@ GEM
122
124
  net-imap
123
125
  net-pop
124
126
  net-smtp
125
- marcel (1.0.4)
127
+ marcel (1.1.0)
126
128
  matrix (0.4.2)
127
129
  mini_mime (1.1.5)
128
130
  minitest (5.25.5)
129
- net-imap (0.4.20)
131
+ net-imap (0.5.10)
130
132
  date
131
133
  net-protocol
132
134
  net-pop (0.1.2)
133
135
  net-protocol
134
136
  net-protocol (0.2.2)
135
137
  timeout
136
- net-smtp (0.5.0)
138
+ net-smtp (0.5.1)
137
139
  net-protocol
138
- nio4r (2.7.3)
139
- nokogiri (1.18.8-x86_64-darwin)
140
+ nio4r (2.7.4)
141
+ nokogiri (1.18.10-arm64-darwin)
140
142
  racc (~> 1.4)
141
- nokogiri (1.18.8-x86_64-linux-gnu)
143
+ nokogiri (1.18.10-x86_64-darwin)
144
+ racc (~> 1.4)
145
+ nokogiri (1.18.10-x86_64-linux-gnu)
142
146
  racc (~> 1.4)
143
147
  nokogiri-diff (0.3.0)
144
148
  nokogiri (~> 1.5)
145
149
  tdiff (~> 0.4)
146
150
  parallel (1.27.0)
147
- parser (3.3.8.0)
151
+ parser (3.3.9.0)
148
152
  ast (~> 2.4.1)
149
153
  racc
150
- prism (1.4.0)
151
- psych (5.1.2)
154
+ pp (0.6.2)
155
+ prettyprint
156
+ prettyprint (0.2.0)
157
+ prism (1.5.1)
158
+ psych (5.2.6)
159
+ date
152
160
  stringio
153
161
  public_suffix (5.0.4)
154
162
  racc (1.8.1)
155
- rack (3.1.16)
163
+ rack (3.2.2)
156
164
  rack-session (2.1.1)
157
165
  base64 (>= 0.1.0)
158
166
  rack (>= 3.0.0)
159
- rack-test (2.1.0)
167
+ rack-test (2.2.0)
160
168
  rack (>= 1.3)
161
- rackup (2.1.0)
169
+ rackup (2.2.1)
162
170
  rack (>= 3)
163
- webrick (~> 1.8)
164
- rails (8.0.2)
165
- actioncable (= 8.0.2)
166
- actionmailbox (= 8.0.2)
167
- actionmailer (= 8.0.2)
168
- actionpack (= 8.0.2)
169
- actiontext (= 8.0.2)
170
- actionview (= 8.0.2)
171
- activejob (= 8.0.2)
172
- activemodel (= 8.0.2)
173
- activerecord (= 8.0.2)
174
- activestorage (= 8.0.2)
175
- activesupport (= 8.0.2)
171
+ rails (8.0.3)
172
+ actioncable (= 8.0.3)
173
+ actionmailbox (= 8.0.3)
174
+ actionmailer (= 8.0.3)
175
+ actionpack (= 8.0.3)
176
+ actiontext (= 8.0.3)
177
+ actionview (= 8.0.3)
178
+ activejob (= 8.0.3)
179
+ activemodel (= 8.0.3)
180
+ activerecord (= 8.0.3)
181
+ activestorage (= 8.0.3)
182
+ activesupport (= 8.0.3)
176
183
  bundler (>= 1.15.0)
177
- railties (= 8.0.2)
178
- rails-dom-testing (2.2.0)
184
+ railties (= 8.0.3)
185
+ rails-dom-testing (2.3.0)
179
186
  activesupport (>= 5.0.0)
180
187
  minitest
181
188
  nokogiri (>= 1.6)
182
- rails-html-sanitizer (1.6.1)
189
+ rails-html-sanitizer (1.6.2)
183
190
  loofah (~> 2.21)
184
191
  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)
185
- railties (8.0.2)
186
- actionpack (= 8.0.2)
187
- activesupport (= 8.0.2)
192
+ railties (8.0.3)
193
+ actionpack (= 8.0.3)
194
+ activesupport (= 8.0.3)
188
195
  irb (~> 1.13)
189
196
  rackup (>= 1.0.0)
190
197
  rake (>= 12.2)
191
198
  thor (~> 1.0, >= 1.2.2)
199
+ tsort (>= 0.2)
192
200
  zeitwerk (~> 2.6)
193
201
  rainbow (3.1.1)
194
202
  rake (13.3.0)
195
- rdoc (6.7.0)
203
+ rdoc (6.14.2)
204
+ erb
196
205
  psych (>= 4.0.0)
197
- regexp_parser (2.10.0)
198
- reline (0.5.9)
206
+ regexp_parser (2.11.3)
207
+ reline (0.6.2)
199
208
  io-console (~> 0.5)
200
209
  rspec (3.13.1)
201
210
  rspec-core (~> 3.13.0)
@@ -210,7 +219,7 @@ GEM
210
219
  diff-lcs (>= 1.2.0, < 2.0)
211
220
  rspec-support (~> 3.13.0)
212
221
  rspec-support (3.13.4)
213
- rubocop (1.77.0)
222
+ rubocop (1.81.1)
214
223
  json (~> 2.3)
215
224
  language_server-protocol (~> 3.17.0.2)
216
225
  lint_roller (~> 1.1.0)
@@ -218,16 +227,16 @@ GEM
218
227
  parser (>= 3.3.0.2)
219
228
  rainbow (>= 2.2.2, < 4.0)
220
229
  regexp_parser (>= 2.9.3, < 3.0)
221
- rubocop-ast (>= 1.45.1, < 2.0)
230
+ rubocop-ast (>= 1.47.1, < 2.0)
222
231
  ruby-progressbar (~> 1.7)
223
232
  unicode-display_width (>= 2.4.0, < 4.0)
224
- rubocop-ast (1.45.1)
233
+ rubocop-ast (1.47.1)
225
234
  parser (>= 3.3.7.2)
226
235
  prism (~> 1.4)
227
236
  rubocop-capybara (2.22.1)
228
237
  lint_roller (~> 1.1)
229
238
  rubocop (~> 1.72, >= 1.72.1)
230
- rubocop-rails (2.32.0)
239
+ rubocop-rails (2.33.4)
231
240
  activesupport (>= 4.2.0)
232
241
  lint_roller (~> 1.1)
233
242
  rack (>= 1.1)
@@ -236,7 +245,7 @@ GEM
236
245
  rubocop-rake (0.7.1)
237
246
  lint_roller (~> 1.1)
238
247
  rubocop (>= 1.72.1)
239
- rubocop-rspec (3.6.0)
248
+ rubocop-rspec (3.7.0)
240
249
  lint_roller (~> 1.1)
241
250
  rubocop (~> 1.72, >= 1.72.1)
242
251
  ruby-progressbar (1.13.0)
@@ -247,27 +256,29 @@ GEM
247
256
  simplecov_json_formatter (~> 0.1)
248
257
  simplecov-html (0.12.3)
249
258
  simplecov_json_formatter (0.1.4)
250
- stringio (3.1.1)
259
+ stringio (3.1.7)
251
260
  tdiff (0.4.0)
252
- thor (1.3.2)
261
+ thor (1.4.0)
253
262
  timeout (0.4.3)
263
+ tsort (0.2.0)
254
264
  tzinfo (2.0.6)
255
265
  concurrent-ruby (~> 1.0)
256
- unicode-display_width (3.1.4)
257
- unicode-emoji (~> 4.0, >= 4.0.4)
258
- unicode-emoji (4.0.4)
266
+ unicode-display_width (3.2.0)
267
+ unicode-emoji (~> 4.1)
268
+ unicode-emoji (4.1.0)
259
269
  uri (1.0.3)
260
270
  useragent (0.16.11)
261
- webrick (1.8.2)
262
- websocket-driver (0.7.6)
271
+ websocket-driver (0.8.0)
272
+ base64
263
273
  websocket-extensions (>= 0.1.0)
264
274
  websocket-extensions (0.1.5)
265
275
  xpath (3.2.0)
266
276
  nokogiri (~> 1.8)
267
277
  yard (0.9.37)
268
- zeitwerk (2.6.18)
278
+ zeitwerk (2.7.3)
269
279
 
270
280
  PLATFORMS
281
+ arm64-darwin-24
271
282
  x86_64-darwin-19
272
283
  x86_64-darwin-20
273
284
  x86_64-darwin-22
@@ -282,13 +293,13 @@ DEPENDENCIES
282
293
  nokogiri-diff (~> 0.3.0)
283
294
  rake (~> 13.3)
284
295
  rspec (~> 3.13)
285
- rubocop (~> 1.77)
296
+ rubocop (~> 1.81)
286
297
  rubocop-capybara (~> 2.22)
287
- rubocop-rails (~> 2.32)
298
+ rubocop-rails (~> 2.33)
288
299
  rubocop-rake (~> 0.7)
289
- rubocop-rspec (~> 3.6)
300
+ rubocop-rspec (~> 3.7)
290
301
  simplecov (~> 0.21)
291
302
  yard (~> 0.9)
292
303
 
293
304
  BUNDLED WITH
294
- 2.5.20
305
+ 2.7.2
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
+ | [3.1.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v3.1.0) | [5.13.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.13.0) | [2.1.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v2.1.0) |
18
+ | [3.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v3.0.0) | [5.11.2](https://github.com/alphagov/govuk-frontend/releases/tag/v5.11.2) | [2.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v2.0.0) |
17
19
  | [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
20
  | [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) |
19
21
  | [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) |
data/bun.lock CHANGED
@@ -3,15 +3,15 @@
3
3
  "workspaces": {
4
4
  "": {
5
5
  "devDependencies": {
6
- "ccs-frontend": "^1.4.1",
7
- "govuk-frontend": "^5.11.0",
6
+ "ccs-frontend": "2.1.0",
7
+ "govuk-frontend": "5.13.0",
8
8
  },
9
9
  },
10
10
  },
11
11
  "packages": {
12
- "ccs-frontend": ["ccs-frontend@1.4.1", "", { "peerDependencies": { "govuk-frontend": "^5.10.0", "jquery": "^3.x" } }, "sha512-dLg0GgJicg+OsGzCofjckYhht8zhD+A/qS6hkJgGg5amIQ2m4WDU+sB4p7CkOX/mooqil8MDdIdcRwtXoydzRw=="],
12
+ "ccs-frontend": ["ccs-frontend@2.1.0", "", { "peerDependencies": { "govuk-frontend": "^5.13.0", "jquery": "^3.x" } }, "sha512-1V+Dcj5r702VsOGizeyfw2+EdxiJM7mipKpkAcah14bnTsb3ofHxdTyimazIRouGwnteKhhpZBhhVai3Yz/pNg=="],
13
13
 
14
- "govuk-frontend": ["govuk-frontend@5.11.0", "", {}, "sha512-RYZDEF1J6nVw5XauQGH+91qplExgHUXfXII7dtIme6I4u3eSvU59yZ0/EFKEwRgTslSqlhJODOnAi5rnQFU5Gw=="],
14
+ "govuk-frontend": ["govuk-frontend@5.13.0", "", {}, "sha512-6N3pHelWN7wftdM6e4YEzZAfattapa1gnd+Al6d5PUbfTr9D+T2dnphpNpjX75CTEhihlQqlL0RDQ3WIfZ3PSg=="],
15
15
 
16
16
  "jquery": ["jquery@3.7.1", "", {}, "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="],
17
17
  }
@@ -1,7 +1,5 @@
1
1
  require_relative '../base'
2
2
  require_relative 'logo'
3
- require_relative 'header/service_authentication'
4
- require_relative 'header/navigation'
5
3
 
6
4
  module CCS
7
5
  module Components
@@ -13,72 +11,42 @@ module CCS
13
11
  #
14
12
  # @!attribute [r] logo
15
13
  # @return [Logo] The initialised Logo component
16
- # @!attribute [r] service_authentication
17
- # @return [ServiceAuthentication] The initialised service authentication section
18
- # @!attribute [r] navigation
19
- # @return [Navigation] The initialised navigation section
20
- # @!attribute [r] service
21
- # @return [Hash] The options for the service section
22
14
 
23
15
  class Header < Base
24
16
  private
25
17
 
26
- attr_reader :logo, :service_authentication, :navigation, :service
18
+ attr_reader :logo
27
19
 
28
20
  public
29
21
 
30
- # @param service_authentication_items [Array<Hash>] An array of links for the service authentication section of the header.
31
- # See {Components::CCS::Header::ServiceAuthentication#initialize ServiceAuthentication#initialize} for details of the items in the array.
32
- # @param navigation [Hash] options for the navigation section of the header.
33
- # See {Components::CCS::Header::Navigation#initialize Navigation#initialize} for details of the options.
34
- # @param menu_button [Hash] options for the menu button in the header.
35
- # See {Components::CCS::Header::Navigation#initialize Navigation#initialize} for details of the options.
36
- # @param service [Hash] options for the service name
37
22
  # @param options [Hash] options that will be used in customising the HTML
38
23
  #
39
- # @option service [String] :name the name of the service, included in the header
40
- # @option service [String] :href URL for the service name anchor
41
- #
42
24
  # @option options [String] :classes additional CSS classes for the header HTML
43
25
  # @option options [String] :container_classes classes for the container
44
26
  # @option options [String] :homepage_url URL of the homepage. Defaults to +/https://www.crowncommercial.gov.uk+
45
27
  # @option options [Hash] :attributes additional attributes that will added as part of the header HTML
46
28
 
47
- def initialize(service_authentication_items: nil, navigation: nil, menu_button: nil, service: nil, **)
48
- super(**)
29
+ def initialize(**)
30
+ super
49
31
 
50
32
  @options[:container_classes] ||= 'govuk-width-container'
51
33
  @options[:homepage_url] ||= 'https://www.crowncommercial.gov.uk'
52
34
 
53
35
  @logo = Logo.new(context: @context)
54
- @service_authentication = ServiceAuthentication.new(service_authentication_items: service_authentication_items, container_classes: @options[:container_classes], context: @context) if service_authentication_items
55
- @navigation = Navigation.new(navigation: navigation, serivce_name_present: service, menu_button: menu_button, context: @context) if navigation && (navigation[:primary_items] || navigation[:secondary_items])
56
- @service = service
57
36
  end
58
37
 
59
- # rubocop:disable Metrics/AbcSize
60
-
61
38
  # Generates the HTML for the CCS Header component
62
39
  #
63
40
  # @return [ActiveSupport::SafeBuffer]
64
41
 
65
42
  def render
66
43
  tag.header(**options[:attributes]) do
67
- concat(service_authentication.render) if service_authentication
68
44
  concat(tag.div(class: "ccs-header__container #{options[:container_classes]}".rstrip) do
69
45
  concat(header_logo)
70
- if service || navigation
71
- concat(tag.div(class: 'ccs-header__content') do
72
- concat(header_service_name) if service
73
- concat(navigation.render) if navigation
74
- end)
75
- end
76
46
  end)
77
47
  end
78
48
  end
79
49
 
80
- # rubocop:enable Metrics/AbcSize
81
-
82
50
  # The default attributes for the breadcrumbs
83
51
 
84
52
  DEFAULT_ATTRIBUTES = { class: 'ccs-header', data: { module: 'ccs-header' } }.freeze
@@ -94,18 +62,6 @@ module CCS
94
62
  link_to(logo.render, options[:homepage_url], class: 'ccs-header__link ccs-header__link--homepage', aria: { label: 'Crown Commercial Service' })
95
63
  end
96
64
  end
97
-
98
- # Generates the service name section
99
- #
100
- # @return [ActiveSupport::SafeBuffer]
101
-
102
- def header_service_name
103
- if service[:href]
104
- link_to(service[:name], service[:href], class: 'ccs-header__link ccs-header__link--service-name')
105
- else
106
- tag.span(service[:name], class: 'ccs-header__link--service-name')
107
- end
108
- end
109
65
  end
110
66
  end
111
67
  end
@@ -18,7 +18,7 @@ module CCS
18
18
  # @return [ActiveSupport::SafeBuffer]
19
19
 
20
20
  def self.render
21
- tag.li('⋯', class: 'govuk-pagination__item govuk-pagination__item--ellipses')
21
+ tag.li('⋯', class: 'govuk-pagination__item govuk-pagination__item--ellipsis')
22
22
  end
23
23
  end
24
24
  end
@@ -12,30 +12,38 @@ module CCS
12
12
  # @return [String] Text for the service navigation link
13
13
  # @!attribute [r] href
14
14
  # @return [String] The href for the service navigation link
15
+ # @!attribute [r] method
16
+ # @return [String] The method for the service navigation request which will make it a button
15
17
 
16
18
  class Link < Base
19
+ include ActionView::Helpers::UrlHelper
20
+
17
21
  private
18
22
 
19
- attr_reader :text, :href
23
+ attr_reader :text, :href, :method
20
24
 
21
25
  public
22
26
 
23
27
  # @param text [String] the text for the service navigation link
24
28
  # @param href [String] the href for the service navigation link
29
+ # @param method [String] the method for the header request which will make it a button
25
30
  # @param options [Hash] options that will be used in customising the HTML
26
31
  #
27
32
  # @option options [Boolean] :active flag to mark the navigation item as active or not
28
33
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
29
34
 
30
- def initialize(text:, href: nil, **options)
35
+ def initialize(text:, href: nil, method: nil, **options)
31
36
  super(**options)
32
37
 
33
38
  @options[:attributes][:aria] = { current: options[:current] ? 'page' : 'true' } if options[:active] || options[:current]
34
39
 
35
40
  @text = text
36
41
  @href = href
42
+ @method = method
37
43
  end
38
44
 
45
+ # rubocop:disable Metrics/AbcSize
46
+
39
47
  # Generates the HTML for the GOV.UK Service navigation link
40
48
  #
41
49
  # @return [ActiveSupport::SafeBuffer]
@@ -43,9 +51,17 @@ module CCS
43
51
  def render
44
52
  tag.li(class: "govuk-service-navigation__item #{'govuk-service-navigation__item--active' if options[:active] || options[:current]}".rstrip) do
45
53
  if href
46
- options[:attributes][:class] = 'govuk-service-navigation__link'
54
+ if method
55
+ options[:attributes][:class] = 'govuk-service-navigation__button_as_link'
47
56
 
48
- link_to(inner_content, href, **options[:attributes])
57
+ button_to(href, method: method, **options[:attributes]) do
58
+ inner_content
59
+ end
60
+ else
61
+ options[:attributes][:class] = 'govuk-service-navigation__link'
62
+
63
+ link_to(inner_content, href, **options[:attributes])
64
+ end
49
65
  else
50
66
  options[:attributes][:class] = 'govuk-service-navigation__text'
51
67
 
@@ -54,6 +70,8 @@ module CCS
54
70
  end
55
71
  end
56
72
 
73
+ # rubocop:enable Metrics/AbcSize
74
+
57
75
  private
58
76
 
59
77
  # Generates the HTML for the inner content of the GOV.UK Service navigation link component
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CCS
4
4
  module FrontendHelpers
5
- VERSION = '2.5.0'
5
+ VERSION = '3.1.0'
6
6
  end
7
7
  end
data/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "CCS",
6
6
  "license": "MIT",
7
7
  "devDependencies": {
8
- "govuk-frontend": "^5.11.0",
9
- "ccs-frontend": "^1.4.1"
8
+ "govuk-frontend": "5.13.0",
9
+ "ccs-frontend": "2.1.0"
10
10
  }
11
11
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ccs-frontend_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crown Commercial Service
@@ -48,9 +48,6 @@ files:
48
48
  - lib/ccs/components/ccs/footer/meta.rb
49
49
  - lib/ccs/components/ccs/footer/navigation.rb
50
50
  - lib/ccs/components/ccs/header.rb
51
- - lib/ccs/components/ccs/header/link.rb
52
- - lib/ccs/components/ccs/header/navigation.rb
53
- - lib/ccs/components/ccs/header/service_authentication.rb
54
51
  - lib/ccs/components/ccs/logo.rb
55
52
  - lib/ccs/components/ccs/password_strength.rb
56
53
  - lib/ccs/components/ccs/password_strength/test.rb
@@ -224,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
221
  - !ruby/object:Gem::Version
225
222
  version: '0'
226
223
  requirements: []
227
- rubygems_version: 3.6.7
224
+ rubygems_version: 3.6.9
228
225
  specification_version: 4
229
226
  summary: Gem containing view helpers for CCS Ruby on Rails projects
230
227
  test_files: []
@@ -1,78 +0,0 @@
1
- require_relative '../../base'
2
-
3
- module CCS
4
- module Components
5
- module CCS
6
- class Header < Base
7
- # = CCS Header link
8
- #
9
- # The individual header link item
10
- #
11
- # @!attribute [r] text
12
- # @return [String] Text for the header link
13
- # @!attribute [r] li_class
14
- # @return [String] The class for the li elements
15
- # @!attribute [r] href
16
- # @return [String] The href for the header link
17
- # @!attribute [r] method
18
- # @return [String] The method for the header request which will make it a button
19
-
20
- class Link < Base
21
- include ActionView::Helpers::UrlHelper
22
-
23
- private
24
-
25
- attr_reader :text, :li_class, :href, :method
26
-
27
- public
28
-
29
- # @param text [String] the text for the header link
30
- # @param li_class [String] class for the li elements
31
- # @param href [String] the href for the header link
32
- # @param method [String] the method for the header request which will make it a button
33
- # @param options [Hash] options that will be used in customising the HTML
34
- #
35
- # @option options [Boolean] :active flag to mark the navigation item as active or not
36
- # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
37
-
38
- def initialize(text:, li_class:, href: nil, method: nil, **)
39
- super(**)
40
-
41
- @text = text
42
- @href = href
43
- @li_class = li_class
44
- @method = method
45
- end
46
-
47
- # rubocop:disable Metrics/AbcSize
48
-
49
- # Generates the HTML for the CCS Header link
50
- #
51
- # @return [ActiveSupport::SafeBuffer]
52
-
53
- def render
54
- tag.li(class: "#{li_class} #{'ccs-header__navigation-item--active' if options[:active]}".rstrip) do
55
- if href
56
- if method
57
- options[:attributes][:class] = 'ccs-header__button_as_link'
58
-
59
- button_to(href, method: method, **options[:attributes]) do
60
- text
61
- end
62
- else
63
- options[:attributes][:class] = 'ccs-header__link'
64
-
65
- link_to(text, href, **options[:attributes])
66
- end
67
- else
68
- text
69
- end
70
- end
71
- end
72
-
73
- # rubocop:enable Metrics/AbcSize
74
- end
75
- end
76
- end
77
- end
78
- end
@@ -1,99 +0,0 @@
1
- require_relative 'link'
2
-
3
- module CCS
4
- module Components
5
- module CCS
6
- class Header < Base
7
- # = CCS Header navigation
8
- #
9
- # The header navigation section
10
- #
11
- # @!attribute [r] primary_links
12
- # @return [Array<Link>] An array of the initialised primary navigation links
13
- # @!attribute [r] secondary_links
14
- # @return [Array<Link>] An array of the initialised secondary navigation links
15
- # @!attribute [r] navigation_label
16
- # @return [String] The aria label for the navigation
17
- # @!attribute [r] navigation_classes
18
- # @return [String] The classes for the navigation
19
- # @!attribute [r] menu_button
20
- # @return [Hash] The options for the menu button
21
-
22
- class Navigation
23
- include ActionView::Context
24
- include ActionView::Helpers
25
-
26
- private
27
-
28
- attr_reader :primary_links, :secondary_links, :navigation_label, :navigation_classes, :menu_button
29
-
30
- public
31
-
32
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
33
-
34
- # @param navigation [Hash] options for the navigation
35
- # @param menu_button [Hash] options for the menu button
36
- # @param context [ActionView::Base] the view context
37
- #
38
- # @option navigation [Array] :primary_items an array of primary links for the navigation section.
39
- # See {Components::CCS::Header::Link#initialize Link#initialize} for details of the items in the array.
40
- # @option navigation [Array] :secondary_items an array of secondary links for the navigation section.
41
- # See {Components::CCS::Header::Link#initialize Link#initialize} for details of the items in the array.
42
- # @option navigation [String] :classes additional CSS classes for the navigation HTML
43
- # @option navigation [String] :label text for the aria-label attribute of the navigation. Defaults to the menu button text
44
- #
45
- # @option menu_button [String] :text text for the button that opens the mobile navigation menu.
46
- # By default, this is set to +Menu+.
47
- # @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
48
- # Defaults to +Show or hide menu+.
49
-
50
- def initialize(navigation:, serivce_name_present:, context:, menu_button: nil)
51
- menu_button ||= {}
52
- menu_button[:text] ||= 'Menu'
53
- menu_button[:label] ||= 'Show or hide menu'
54
-
55
- @menu_button = menu_button
56
- @primary_links = navigation[:primary_items]&.map { |navigation_link| Link.new(li_class: LI_CLASS, context: context, **navigation_link) }
57
- @secondary_links = navigation[:secondary_items]&.map { |navigation_link| Link.new(li_class: LI_CLASS, context: context, **navigation_link) }
58
- @navigation_label = navigation[:label] || menu_button[:text]
59
- @navigation_classes = 'ccs-header__navigation'
60
- @navigation_classes << ' ccs-header__navigation--no-service-name' unless serivce_name_present
61
- @navigation_classes << " #{navigation[:classes]}" if navigation[:classes]
62
- end
63
-
64
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
65
-
66
- # rubocop:disable Metrics/AbcSize
67
-
68
- # Generates the HTML for the GOV.UK Navigation
69
- #
70
- # @return [ActiveSupport::SafeBuffer]
71
-
72
- def render
73
- tag.nav(aria: { label: navigation_label }, class: navigation_classes) do
74
- concat(button_tag(menu_button[:text], type: :button, class: 'ccs-header__menu-button ccs-js-header-toggle', aria: { controls: 'navigation', label: menu_button[:label] }, hidden: true))
75
- concat(tag.div(id: 'navigation', class: 'ccs-header__navigation-lists') do
76
- if secondary_links
77
- concat(tag.ul(id: 'navigation-secondary', class: "ccs-header__navigation-secondary-list #{'ccs-header__navigation--no-second-list' unless primary_links}".rstrip) do
78
- secondary_links.each { |secondary_link| concat(secondary_link.render) }
79
- end)
80
- end
81
- if primary_links
82
- concat(tag.ul(id: 'navigation-primary', class: "ccs-header__navigation-primary-list #{'ccs-header__navigation--no-second-list' unless secondary_links}".rstrip) do
83
- primary_links.each { |primary_link| concat(primary_link.render) }
84
- end)
85
- end
86
- end)
87
- end
88
- end
89
-
90
- # rubocop:enable Metrics/AbcSize
91
-
92
- # The li class for the navigation links
93
-
94
- LI_CLASS = 'ccs-header__navigation-item'.freeze
95
- end
96
- end
97
- end
98
- end
99
- end
@@ -1,53 +0,0 @@
1
- require_relative 'link'
2
-
3
- module CCS
4
- module Components
5
- module CCS
6
- class Header < Base
7
- # = CCS Header Service Authentication
8
- #
9
- # The individual footer navigation item
10
- #
11
- # @!attribute [r] service_authentication_links
12
- # @return [Array<Link>] An array of the initialised service authentication links
13
- # @!attribute [r] container_classes
14
- # @return [String] classes for the container
15
-
16
- class ServiceAuthentication
17
- include ActionView::Context
18
- include ActionView::Helpers
19
-
20
- private
21
-
22
- attr_reader :service_authentication_links, :container_classes
23
-
24
- public
25
-
26
- # @param service_authentication_items [Array<Hash>] an array of links for the service authentication section.
27
- # See {Components::CCS::Header::Link#initialize Link#initialize} for details of the items in the array.
28
- # @param container_classes [String] classes for the container
29
- # @param context [ActionView::Base] the view context
30
-
31
- def initialize(service_authentication_items:, context:, container_classes: nil)
32
- @service_authentication_links = service_authentication_items&.map { |service_authentication_link| Link.new(li_class: 'ccs-header__service-authentication-item', active: false, context: context, **service_authentication_link) }
33
- @container_classes = container_classes
34
- end
35
-
36
- # Generates the HTML for the CCS Footer Meta sections
37
- #
38
- # @return [ActiveSupport::SafeBuffer]
39
-
40
- def render
41
- tag.div(class: 'ccs-header__service-authentication') do
42
- tag.div(class: "ccs-header__service-authentication-container #{container_classes}".rstrip) do
43
- tag.ul(class: 'ccs-header__service-authentication-list') do
44
- service_authentication_links.each { |service_authentication_link| concat(service_authentication_link.render) }
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end