ccs-frontend_helpers 2.5.0 → 3.0.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: 6bc177abb107154b6fe83789dfb5e7b26c88542792026809b2329af9ddc5baed
4
+ data.tar.gz: 9c577ff2f803f55013e01a4f583ad48a89092e16f68d97bbe58e9265ca99b326
5
5
  SHA512:
6
- metadata.gz: 5c182ff9293312d0daf639452012b70e33019164716980787510269bce4ec600ff84d81777995d33ec3f50217f4fe92e527cdb81cb917a71f002f7d1083f7de4
7
- data.tar.gz: 8a0cae10f0ec8faad8773e91449c53dae0e91612aaac226ee2e70a8c556a4e63bb457becfcf14586781b082fb0a1a823bc69c9fc989db03fe1b5b203443708e3
6
+ metadata.gz: fc08f641f7dbada53b10bb254449c9320e40de43a6e6d6d0e346e7fbb256ef0f65a821066398f3a4bfe89fe134d8131e2e43fc8f6ab3a9811a047edb72284a14
7
+ data.tar.gz: e894512b90e0f6d56785eee80a3dcd454689bc7a65d96b12e05358912cb5b3385d5ef425237a25ee8ce0ac51eb617d6d560e2dcaa2504befc508cf9ddcf3b00c
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0] - 2025-08-27
11
+
12
+ ### Added
13
+
14
+ - Updated CCS Frontend to v2.0.0
15
+
16
+ ### Removed
17
+
18
+ - The CCS Header is now just the logo as all other parts should now go in the GOV.UK Service Navigation component
19
+
10
20
  ## [2.5.0] - 2025-06-30
11
21
 
12
22
  ### Added
data/Gemfile CHANGED
@@ -16,9 +16,9 @@ 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.80'
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
23
  gem 'rubocop-rspec', '~> 3.6'
24
24
 
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.0.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.2.1)
11
+ actionpack (= 8.0.2.1)
12
+ activesupport (= 8.0.2.1)
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.2.1)
17
+ actionpack (= 8.0.2.1)
18
+ activejob (= 8.0.2.1)
19
+ activerecord (= 8.0.2.1)
20
+ activestorage (= 8.0.2.1)
21
+ activesupport (= 8.0.2.1)
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.2.1)
24
+ actionpack (= 8.0.2.1)
25
+ actionview (= 8.0.2.1)
26
+ activejob (= 8.0.2.1)
27
+ activesupport (= 8.0.2.1)
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.2.1)
31
+ actionview (= 8.0.2.1)
32
+ activesupport (= 8.0.2.1)
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.2.1)
41
+ actionpack (= 8.0.2.1)
42
+ activerecord (= 8.0.2.1)
43
+ activestorage (= 8.0.2.1)
44
+ activesupport (= 8.0.2.1)
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.2.1)
48
+ activesupport (= 8.0.2.1)
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.2.1)
54
+ activesupport (= 8.0.2.1)
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.2.1)
57
+ activesupport (= 8.0.2.1)
58
+ activerecord (8.0.2.1)
59
+ activemodel (= 8.0.2.1)
60
+ activesupport (= 8.0.2.1)
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.2.1)
63
+ actionpack (= 8.0.2.1)
64
+ activejob (= 8.0.2.1)
65
+ activerecord (= 8.0.2.1)
66
+ activesupport (= 8.0.2.1)
67
67
  marcel (~> 1.0)
68
- activesupport (8.0.2)
68
+ activesupport (8.0.2.1)
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.2)
87
87
  builder (3.3.0)
88
88
  capybara (3.40.0)
89
89
  addressable
@@ -100,17 +100,19 @@ GEM
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)
103
+ drb (2.2.3)
104
+ erb (5.0.2)
105
+ erubi (1.13.1)
105
106
  globalid (1.2.1)
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.13.2)
114
116
  language_server-protocol (3.17.0.5)
115
117
  lint_roller (1.1.0)
116
118
  logger (1.7.0)
@@ -126,65 +128,70 @@ GEM
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.9)
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.9-arm64-darwin)
140
142
  racc (~> 1.4)
141
- nokogiri (1.18.8-x86_64-linux-gnu)
143
+ nokogiri (1.18.9-x86_64-darwin)
144
+ racc (~> 1.4)
145
+ nokogiri (1.18.9-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
154
+ pp (0.6.2)
155
+ prettyprint
156
+ prettyprint (0.2.0)
150
157
  prism (1.4.0)
151
- psych (5.1.2)
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.0)
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.2.1)
172
+ actioncable (= 8.0.2.1)
173
+ actionmailbox (= 8.0.2.1)
174
+ actionmailer (= 8.0.2.1)
175
+ actionpack (= 8.0.2.1)
176
+ actiontext (= 8.0.2.1)
177
+ actionview (= 8.0.2.1)
178
+ activejob (= 8.0.2.1)
179
+ activemodel (= 8.0.2.1)
180
+ activerecord (= 8.0.2.1)
181
+ activestorage (= 8.0.2.1)
182
+ activesupport (= 8.0.2.1)
176
183
  bundler (>= 1.15.0)
177
- railties (= 8.0.2)
178
- rails-dom-testing (2.2.0)
184
+ railties (= 8.0.2.1)
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.2.1)
193
+ actionpack (= 8.0.2.1)
194
+ activesupport (= 8.0.2.1)
188
195
  irb (~> 1.13)
189
196
  rackup (>= 1.0.0)
190
197
  rake (>= 12.2)
@@ -192,10 +199,11 @@ GEM
192
199
  zeitwerk (~> 2.6)
193
200
  rainbow (3.1.1)
194
201
  rake (13.3.0)
195
- rdoc (6.7.0)
202
+ rdoc (6.14.2)
203
+ erb
196
204
  psych (>= 4.0.0)
197
- regexp_parser (2.10.0)
198
- reline (0.5.9)
205
+ regexp_parser (2.11.2)
206
+ reline (0.6.2)
199
207
  io-console (~> 0.5)
200
208
  rspec (3.13.1)
201
209
  rspec-core (~> 3.13.0)
@@ -210,7 +218,7 @@ GEM
210
218
  diff-lcs (>= 1.2.0, < 2.0)
211
219
  rspec-support (~> 3.13.0)
212
220
  rspec-support (3.13.4)
213
- rubocop (1.77.0)
221
+ rubocop (1.80.0)
214
222
  json (~> 2.3)
215
223
  language_server-protocol (~> 3.17.0.2)
216
224
  lint_roller (~> 1.1.0)
@@ -218,16 +226,16 @@ GEM
218
226
  parser (>= 3.3.0.2)
219
227
  rainbow (>= 2.2.2, < 4.0)
220
228
  regexp_parser (>= 2.9.3, < 3.0)
221
- rubocop-ast (>= 1.45.1, < 2.0)
229
+ rubocop-ast (>= 1.46.0, < 2.0)
222
230
  ruby-progressbar (~> 1.7)
223
231
  unicode-display_width (>= 2.4.0, < 4.0)
224
- rubocop-ast (1.45.1)
232
+ rubocop-ast (1.46.0)
225
233
  parser (>= 3.3.7.2)
226
234
  prism (~> 1.4)
227
235
  rubocop-capybara (2.22.1)
228
236
  lint_roller (~> 1.1)
229
237
  rubocop (~> 1.72, >= 1.72.1)
230
- rubocop-rails (2.32.0)
238
+ rubocop-rails (2.33.3)
231
239
  activesupport (>= 4.2.0)
232
240
  lint_roller (~> 1.1)
233
241
  rack (>= 1.1)
@@ -247,27 +255,28 @@ GEM
247
255
  simplecov_json_formatter (~> 0.1)
248
256
  simplecov-html (0.12.3)
249
257
  simplecov_json_formatter (0.1.4)
250
- stringio (3.1.1)
258
+ stringio (3.1.7)
251
259
  tdiff (0.4.0)
252
- thor (1.3.2)
260
+ thor (1.4.0)
253
261
  timeout (0.4.3)
254
262
  tzinfo (2.0.6)
255
263
  concurrent-ruby (~> 1.0)
256
- unicode-display_width (3.1.4)
264
+ unicode-display_width (3.1.5)
257
265
  unicode-emoji (~> 4.0, >= 4.0.4)
258
266
  unicode-emoji (4.0.4)
259
267
  uri (1.0.3)
260
268
  useragent (0.16.11)
261
- webrick (1.8.2)
262
- websocket-driver (0.7.6)
269
+ websocket-driver (0.8.0)
270
+ base64
263
271
  websocket-extensions (>= 0.1.0)
264
272
  websocket-extensions (0.1.5)
265
273
  xpath (3.2.0)
266
274
  nokogiri (~> 1.8)
267
275
  yard (0.9.37)
268
- zeitwerk (2.6.18)
276
+ zeitwerk (2.7.3)
269
277
 
270
278
  PLATFORMS
279
+ arm64-darwin-24
271
280
  x86_64-darwin-19
272
281
  x86_64-darwin-20
273
282
  x86_64-darwin-22
@@ -282,9 +291,9 @@ DEPENDENCIES
282
291
  nokogiri-diff (~> 0.3.0)
283
292
  rake (~> 13.3)
284
293
  rspec (~> 3.13)
285
- rubocop (~> 1.77)
294
+ rubocop (~> 1.80)
286
295
  rubocop-capybara (~> 2.22)
287
- rubocop-rails (~> 2.32)
296
+ rubocop-rails (~> 2.33)
288
297
  rubocop-rake (~> 0.7)
289
298
  rubocop-rspec (~> 3.6)
290
299
  simplecov (~> 0.21)
data/README.md CHANGED
@@ -14,6 +14,7 @@ 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.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
18
  | [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
19
  | [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
20
  | [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.0.0",
7
+ "govuk-frontend": "5.11.2",
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.0.0", "", { "peerDependencies": { "govuk-frontend": "^5.11.2", "jquery": "^3.x" } }, "sha512-hPr44+qN+w8UpJ+vNxoiMV7alDpvEhJSZhJXyxJ+4gzuEQedFcgBHjyksJ+AghsKjPChH/X45EtRxyuggi4pIA=="],
13
13
 
14
- "govuk-frontend": ["govuk-frontend@5.11.0", "", {}, "sha512-RYZDEF1J6nVw5XauQGH+91qplExgHUXfXII7dtIme6I4u3eSvU59yZ0/EFKEwRgTslSqlhJODOnAi5rnQFU5Gw=="],
14
+ "govuk-frontend": ["govuk-frontend@5.11.2", "", {}, "sha512-eHV8EMxYNjc+omFhB0HktQ3QmA3ZRdDsgRDlUIik+TpUHerR3XKXpo4zh/OGO2/C2mz65cX0XT0k4QrRFJZU8Q=="],
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
@@ -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.0.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.11.2",
9
+ "ccs-frontend": "2.0.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.0.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
@@ -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