ccs-frontend_helpers 1.0.0 → 1.1.0.beta0

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: 5cfc2dfc3dbb88c768965f0ef64ab401d6371504da7c5034d878324b8c1a7eb5
4
- data.tar.gz: ee90259514dfde17c22e0f4b8cf141b3bafbe476258ac4ce0eac00ac9d63694e
3
+ metadata.gz: 268588c1c5fea8b4aef3d3ef718cc6e60b7107653fd75453ea4226391fdeffcb
4
+ data.tar.gz: 11b35cc9d15251648e4c2db1192648fac15fdbfd5e6357f580f2fe892786cca3
5
5
  SHA512:
6
- metadata.gz: b039bc60d2fdf4bbb18522aee755bb1f3f2473a6052d6268e9c2fb7a83151b9853e8f967d1c827d7342e2ee22a4f07b79c358dc0e030baa540f03c77e32fdd19
7
- data.tar.gz: ca64673fd4c57afe133cdd6169c9fc2d25a5151b5ce51f9dce78d90df0d101795625c6d02ae63781b4bae415d87596b9c8b26cb8fd4a1cac0ff56919a568898b
6
+ metadata.gz: 609c90727c1e653a44b112e358b2541a2fd4d95de810aded4dc032e96cac12f1f9b612d5953a34501abe3f8b3486c8b12f1670f440c55dd363ca3001ec357436
7
+ data.tar.gz: 8fd4c28172ea2a8e62fc32d9ef4742414d0dce8f0b86c8c109ebb77bbb0fca41234c764e871b935e353fc223655714ee7b2162a629a9ecc8e2ab7fc86fb94cd9
data/.rubocop.yml CHANGED
@@ -1,18 +1,77 @@
1
1
  ---
2
2
  require:
3
- - rubocop-rspec
4
- - rubocop-rails
5
- - rubocop-rake
6
- - rubocop-capybara
3
+ - rubocop-capybara
4
+ - rubocop-rspec
5
+ - rubocop-rails
6
+ - rubocop-rake
7
7
 
8
8
  AllCops:
9
9
  NewCops: enable
10
10
  TargetRubyVersion: 3.0
11
11
  Exclude:
12
- - 'bin/**/*'
13
- - 'tmp/**/*'
14
- - 'vendor/**/*'
12
+ - "bin/**/*"
13
+ - "tmp/**/*"
14
+ - "vendor/**/*"
15
15
 
16
+ # Capyabara rubocop config
17
+ Capybara:
18
+ Enabled: true
19
+
20
+ # Rails rubocop config
21
+ Rails:
22
+ Enabled: true
23
+
24
+ Rails/HelperInstanceVariable:
25
+ Enabled: false
26
+
27
+ Rails/DynamicFindBy:
28
+ Whitelist:
29
+ - find_by_id
30
+
31
+ Rails/FilePath:
32
+ Enabled: false
33
+
34
+ Rails/OutputSafety:
35
+ Exclude:
36
+ - "spec/ccs/frontend_helpers/**/*fixtures_spec.rb"
37
+
38
+ # RSpec rubocop config
39
+ RSpec:
40
+ Enabled: true
41
+
42
+ RSpec/ContextWording:
43
+ Prefixes:
44
+ - when
45
+ - with
46
+ - without
47
+ - and
48
+
49
+ RSpec/MultipleMemoizedHelpers:
50
+ Enabled: false
51
+
52
+ RSpec/VariableName:
53
+ Enabled: false
54
+
55
+ RSpec/VerifiedDoubleReference:
56
+ Enabled: false
57
+
58
+ RSpec/NestedGroups:
59
+ Max: 5
60
+
61
+ RSpec/ExampleLength:
62
+ Exclude:
63
+ - "spec/ccs/frontend_helpers/**/*"
64
+ - "spec/ccs/components/**/*"
65
+
66
+ RSpec/MultipleExpectations:
67
+ Max: 3
68
+
69
+ RSpec/SpecFilePathFormat:
70
+ CustomTransform:
71
+ GovUKFrontend: govuk_frontend
72
+ GovUK: govuk
73
+
74
+ # Standard rubocop config
16
75
  Bundler/OrderedGems:
17
76
  Enabled: false
18
77
 
@@ -47,7 +106,7 @@ Style/ClassAndModuleChildren:
47
106
  Enabled: false
48
107
 
49
108
  Layout/EndOfLine:
50
- EnforcedStyle: lf
109
+ EnforcedStyle: lf
51
110
 
52
111
  Layout/TrailingEmptyLines:
53
112
  Enabled: true
@@ -56,9 +115,9 @@ Layout/LineLength:
56
115
  Max: 120
57
116
  Enabled: false
58
117
  AllowedPatterns:
59
- - 'it .* do$'
60
- - 'context .* do$'
61
- - 'scenario .* do$'
118
+ - "it .* do$"
119
+ - "context .* do$"
120
+ - "scenario .* do$"
62
121
 
63
122
  Metrics/ClassLength:
64
123
  Enabled: false
@@ -70,30 +129,17 @@ Metrics/MethodLength:
70
129
  Metrics/AbcSize:
71
130
  Max: 25 # TODO: Restore to '20'
72
131
  Exclude:
73
- - 'spec/**/*'
132
+ - "spec/**/*"
74
133
 
75
134
  Metrics/BlockLength:
76
135
  Max: 40
77
136
  Exclude:
78
- - 'spec/**/*'
79
-
80
- RSpec/ContextWording:
81
- Prefixes:
82
- - when
83
- - with
84
- - without
85
- - and
137
+ - "spec/**/*"
86
138
 
87
139
  Metrics/ModuleLength:
88
140
  Exclude:
89
- - 'spec/ccs/frontend_helpers/**/*'
90
- - 'spec/ccs/components/**/*'
91
-
92
- RSpec/MultipleMemoizedHelpers:
93
- Enabled: false
94
-
95
- RSpec/VariableName:
96
- Enabled: false
141
+ - "spec/ccs/frontend_helpers/**/*"
142
+ - "spec/ccs/components/**/*"
97
143
 
98
144
  Naming/VariableNumber:
99
145
  Enabled: false
@@ -101,38 +147,5 @@ Naming/VariableNumber:
101
147
  Lint/MissingSuper:
102
148
  Enabled: false
103
149
 
104
- Rails/HelperInstanceVariable:
105
- Enabled: false
106
-
107
150
  Style/OptionalBooleanParameter:
108
151
  Enabled: false
109
-
110
- RSpec/VerifiedDoubleReference:
111
- Enabled: false
112
-
113
- RSpec/NestedGroups:
114
- Max: 5
115
-
116
- RSpec/ExampleLength:
117
- Exclude:
118
- - 'spec/ccs/frontend_helpers/**/*'
119
- - 'spec/ccs/components/**/*'
120
-
121
- Rails/DynamicFindBy:
122
- Whitelist:
123
- - find_by_id
124
-
125
- RSpec/MultipleExpectations:
126
- Max: 3
127
-
128
- RSpec/FilePath:
129
- Enabled: false
130
-
131
- RSpec/SpecFilePathFormat:
132
- CustomTransform:
133
- GovUKFrontend: govuk_frontend
134
- GovUK: govuk
135
-
136
- Rails/OutputSafety:
137
- Exclude:
138
- - 'spec/ccs/frontend_helpers/**/*fixtures_spec.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.3.1
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
+ ## [1.1.0-beta0] - 2024-06-28
11
+
12
+ ### Added
13
+
14
+ - Update to CCS Frontend v1.1
15
+
16
+ - The following CCS helpers have been added:
17
+ - Contact Us
18
+ - Password Strength
19
+
10
20
  ## [1.0.0] - 2024-06-07
11
21
 
12
22
  ### Changed
data/Gemfile CHANGED
@@ -17,9 +17,10 @@ gem 'nokogiri-diff', '~> 0.3.0'
17
17
 
18
18
  # Gems for linting/formatting the package
19
19
  gem 'rubocop', '~> 1.64'
20
+ gem 'rubocop-capybara', '~> 2.20'
20
21
  gem 'rubocop-rails', '~> 2.25'
21
22
  gem 'rubocop-rake', '~> 0.6'
22
- gem 'rubocop-rspec', '~> 2.29'
23
+ gem 'rubocop-rspec', '~> 3.0'
23
24
 
24
25
  # Gems for documenting the package
25
26
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,41 +1,41 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (1.0.0)
4
+ ccs-frontend_helpers (1.1.0.beta0)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.3.3)
11
- actionpack (= 7.1.3.3)
12
- activesupport (= 7.1.3.3)
10
+ actioncable (7.1.3.4)
11
+ actionpack (= 7.1.3.4)
12
+ activesupport (= 7.1.3.4)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.3.3)
17
- actionpack (= 7.1.3.3)
18
- activejob (= 7.1.3.3)
19
- activerecord (= 7.1.3.3)
20
- activestorage (= 7.1.3.3)
21
- activesupport (= 7.1.3.3)
16
+ actionmailbox (7.1.3.4)
17
+ actionpack (= 7.1.3.4)
18
+ activejob (= 7.1.3.4)
19
+ activerecord (= 7.1.3.4)
20
+ activestorage (= 7.1.3.4)
21
+ activesupport (= 7.1.3.4)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.1.3.3)
27
- actionpack (= 7.1.3.3)
28
- actionview (= 7.1.3.3)
29
- activejob (= 7.1.3.3)
30
- activesupport (= 7.1.3.3)
26
+ actionmailer (7.1.3.4)
27
+ actionpack (= 7.1.3.4)
28
+ actionview (= 7.1.3.4)
29
+ activejob (= 7.1.3.4)
30
+ activesupport (= 7.1.3.4)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.3.3)
37
- actionview (= 7.1.3.3)
38
- activesupport (= 7.1.3.3)
36
+ actionpack (7.1.3.4)
37
+ actionview (= 7.1.3.4)
38
+ activesupport (= 7.1.3.4)
39
39
  nokogiri (>= 1.8.5)
40
40
  racc
41
41
  rack (>= 2.2.4)
@@ -43,35 +43,35 @@ GEM
43
43
  rack-test (>= 0.6.3)
44
44
  rails-dom-testing (~> 2.2)
45
45
  rails-html-sanitizer (~> 1.6)
46
- actiontext (7.1.3.3)
47
- actionpack (= 7.1.3.3)
48
- activerecord (= 7.1.3.3)
49
- activestorage (= 7.1.3.3)
50
- activesupport (= 7.1.3.3)
46
+ actiontext (7.1.3.4)
47
+ actionpack (= 7.1.3.4)
48
+ activerecord (= 7.1.3.4)
49
+ activestorage (= 7.1.3.4)
50
+ activesupport (= 7.1.3.4)
51
51
  globalid (>= 0.6.0)
52
52
  nokogiri (>= 1.8.5)
53
- actionview (7.1.3.3)
54
- activesupport (= 7.1.3.3)
53
+ actionview (7.1.3.4)
54
+ activesupport (= 7.1.3.4)
55
55
  builder (~> 3.1)
56
56
  erubi (~> 1.11)
57
57
  rails-dom-testing (~> 2.2)
58
58
  rails-html-sanitizer (~> 1.6)
59
- activejob (7.1.3.3)
60
- activesupport (= 7.1.3.3)
59
+ activejob (7.1.3.4)
60
+ activesupport (= 7.1.3.4)
61
61
  globalid (>= 0.3.6)
62
- activemodel (7.1.3.3)
63
- activesupport (= 7.1.3.3)
64
- activerecord (7.1.3.3)
65
- activemodel (= 7.1.3.3)
66
- activesupport (= 7.1.3.3)
62
+ activemodel (7.1.3.4)
63
+ activesupport (= 7.1.3.4)
64
+ activerecord (7.1.3.4)
65
+ activemodel (= 7.1.3.4)
66
+ activesupport (= 7.1.3.4)
67
67
  timeout (>= 0.4.0)
68
- activestorage (7.1.3.3)
69
- actionpack (= 7.1.3.3)
70
- activejob (= 7.1.3.3)
71
- activerecord (= 7.1.3.3)
72
- activesupport (= 7.1.3.3)
68
+ activestorage (7.1.3.4)
69
+ actionpack (= 7.1.3.4)
70
+ activejob (= 7.1.3.4)
71
+ activerecord (= 7.1.3.4)
72
+ activesupport (= 7.1.3.4)
73
73
  marcel (~> 1.0)
74
- activesupport (7.1.3.3)
74
+ activesupport (7.1.3.4)
75
75
  base64
76
76
  bigdecimal
77
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -96,7 +96,7 @@ GEM
96
96
  rack-test (>= 0.6.3)
97
97
  regexp_parser (>= 1.5, < 3.0)
98
98
  xpath (~> 3.2)
99
- concurrent-ruby (1.2.3)
99
+ concurrent-ruby (1.3.2)
100
100
  connection_pool (2.4.1)
101
101
  crass (1.0.6)
102
102
  date (3.3.4)
@@ -125,7 +125,7 @@ GEM
125
125
  marcel (1.0.4)
126
126
  matrix (0.4.2)
127
127
  mini_mime (1.1.5)
128
- minitest (5.23.0)
128
+ minitest (5.23.1)
129
129
  mutex_m (0.2.0)
130
130
  net-imap (0.4.12)
131
131
  date
@@ -144,8 +144,8 @@ GEM
144
144
  nokogiri-diff (0.3.0)
145
145
  nokogiri (~> 1.5)
146
146
  tdiff (~> 0.4)
147
- parallel (1.24.0)
148
- parser (3.3.2.0)
147
+ parallel (1.25.1)
148
+ parser (3.3.3.0)
149
149
  ast (~> 2.4.1)
150
150
  racc
151
151
  psych (5.1.2)
@@ -160,20 +160,20 @@ GEM
160
160
  rackup (2.1.0)
161
161
  rack (>= 3)
162
162
  webrick (~> 1.8)
163
- rails (7.1.3.3)
164
- actioncable (= 7.1.3.3)
165
- actionmailbox (= 7.1.3.3)
166
- actionmailer (= 7.1.3.3)
167
- actionpack (= 7.1.3.3)
168
- actiontext (= 7.1.3.3)
169
- actionview (= 7.1.3.3)
170
- activejob (= 7.1.3.3)
171
- activemodel (= 7.1.3.3)
172
- activerecord (= 7.1.3.3)
173
- activestorage (= 7.1.3.3)
174
- activesupport (= 7.1.3.3)
163
+ rails (7.1.3.4)
164
+ actioncable (= 7.1.3.4)
165
+ actionmailbox (= 7.1.3.4)
166
+ actionmailer (= 7.1.3.4)
167
+ actionpack (= 7.1.3.4)
168
+ actiontext (= 7.1.3.4)
169
+ actionview (= 7.1.3.4)
170
+ activejob (= 7.1.3.4)
171
+ activemodel (= 7.1.3.4)
172
+ activerecord (= 7.1.3.4)
173
+ activestorage (= 7.1.3.4)
174
+ activesupport (= 7.1.3.4)
175
175
  bundler (>= 1.15.0)
176
- railties (= 7.1.3.3)
176
+ railties (= 7.1.3.4)
177
177
  rails-dom-testing (2.2.0)
178
178
  activesupport (>= 5.0.0)
179
179
  minitest
@@ -181,9 +181,9 @@ GEM
181
181
  rails-html-sanitizer (1.6.0)
182
182
  loofah (~> 2.21)
183
183
  nokogiri (~> 1.14)
184
- railties (7.1.3.3)
185
- actionpack (= 7.1.3.3)
186
- activesupport (= 7.1.3.3)
184
+ railties (7.1.3.4)
185
+ actionpack (= 7.1.3.4)
186
+ activesupport (= 7.1.3.4)
187
187
  irb
188
188
  rackup (>= 1.0.0)
189
189
  rake (>= 12.2)
@@ -196,8 +196,8 @@ GEM
196
196
  regexp_parser (2.9.2)
197
197
  reline (0.5.8)
198
198
  io-console (~> 0.5)
199
- rexml (3.2.8)
200
- strscan (>= 3.0.9)
199
+ rexml (3.3.0)
200
+ strscan
201
201
  rspec (3.13.0)
202
202
  rspec-core (~> 3.13.0)
203
203
  rspec-expectations (~> 3.13.0)
@@ -224,9 +224,7 @@ GEM
224
224
  unicode-display_width (>= 2.4.0, < 3.0)
225
225
  rubocop-ast (1.31.3)
226
226
  parser (>= 3.3.1.0)
227
- rubocop-capybara (2.20.0)
228
- rubocop (~> 1.41)
229
- rubocop-factory_bot (2.25.1)
227
+ rubocop-capybara (2.21.0)
230
228
  rubocop (~> 1.41)
231
229
  rubocop-rails (2.25.0)
232
230
  activesupport (>= 4.2.0)
@@ -235,13 +233,8 @@ GEM
235
233
  rubocop-ast (>= 1.31.1, < 2.0)
236
234
  rubocop-rake (0.6.0)
237
235
  rubocop (~> 1.0)
238
- rubocop-rspec (2.29.2)
239
- rubocop (~> 1.40)
240
- rubocop-capybara (~> 2.17)
241
- rubocop-factory_bot (~> 2.22)
242
- rubocop-rspec_rails (~> 2.28)
243
- rubocop-rspec_rails (2.28.3)
244
- rubocop (~> 1.40)
236
+ rubocop-rspec (3.0.1)
237
+ rubocop (~> 1.61)
245
238
  ruby-progressbar (1.13.0)
246
239
  simplecov (0.22.0)
247
240
  docile (~> 1.1)
@@ -269,6 +262,7 @@ GEM
269
262
  PLATFORMS
270
263
  x86_64-darwin-19
271
264
  x86_64-darwin-20
265
+ x86_64-darwin-22
272
266
  x86_64-linux
273
267
 
274
268
  DEPENDENCIES
@@ -279,9 +273,10 @@ DEPENDENCIES
279
273
  rake (~> 13.2)
280
274
  rspec (~> 3.13)
281
275
  rubocop (~> 1.64)
276
+ rubocop-capybara (~> 2.20)
282
277
  rubocop-rails (~> 2.25)
283
278
  rubocop-rake (~> 0.6)
284
- rubocop-rspec (~> 2.29)
279
+ rubocop-rspec (~> 3.0)
285
280
  simplecov (~> 0.21)
286
281
  yard (~> 0.9)
287
282
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CCS Frontend Helpers
2
2
 
3
- [![Ruby](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/actions/workflows/main.yml/badge.svg)](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/actions/workflows/main.yml)
3
+ [![Ruby](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/actions/workflows/release.yml/badge.svg)](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/actions/workflows/release.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/ccs-frontend_helpers.svg)](https://badge.fury.io/rb/ccs-frontend_helpers)
5
5
 
6
6
  The CCS Frontend Helpers gem was created for use in the Crown Marketplace projects at the Crown Commercial Service.
@@ -14,7 +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
- | [1.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v1.0.0) | [5.4.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.4.0) | [1.0.0-beta.5](https://github.com/tim-s-ccs/ccs-frontend-project/releases/tag/v1.0.0) |
17
+ | [1.1.0.beta0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v[1.1.0.beta0) | [5.4.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.4.0) | [1.1.0-beta.2](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/1.1.0-beta.2) |
18
+ | [1.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v1.0.0) | [5.4.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.4.0) | [1.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.0.0) |
18
19
  | [0.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v0.4.0) | [5.4.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.4.0) | N/A |
19
20
  | [0.3.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v0.3.0) | [5.3.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.3.0) | N/A |
20
21
  | [0.2.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v0.2.0) | [5.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.2.0) | N/A |
@@ -0,0 +1,70 @@
1
+ require_relative '../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module CCS
6
+ # = CCS Contract Us
7
+ #
8
+ # This is used for generating the contact us component from the
9
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/header CCS - Components - Contact Us}
10
+ #
11
+ # @!attribute [r] contact_us_link_href
12
+ # @return [String] Contact us link href
13
+ # @!attribute [r] contact_us_link_text
14
+ # @return [String] Contact us link text
15
+ # @!attribute [r] having_problems_text
16
+ # @return [String] Having problem text
17
+ # @!attribute [r] contact_us_text
18
+ # @return [String] Contact use text
19
+
20
+ class ContactUs < Base
21
+ private
22
+
23
+ attr_reader :contact_us_link_href, :contact_us_link_text, :having_problems_text, :contact_us_text
24
+
25
+ public
26
+
27
+ # @param contact_us_link_href [String] Contact us link href
28
+ # @param contact_us_link_text [String] Contact us link text, defaults to "Contact us (opens in a new tab)"
29
+ # @param having_problems_text [String] Having problem text, defaults to "Having problems with this service?"
30
+ # @param contact_us_text [String] Contact use text, defaults to "for support."
31
+ #
32
+ # @option options [String] :classes additional CSS classes for the contact us HTML
33
+ # @option options [Hash] :attributes additional attributes that will added as part of the contact us HTML
34
+
35
+ def initialize(contact_us_link_href:, having_problems_text: nil, contact_us_link_text: nil, contact_us_text: nil, **options)
36
+ super(**options)
37
+
38
+ @contact_us_link_href = contact_us_link_href
39
+ @contact_us_link_text = contact_us_link_text || 'Contact us (opens in a new tab)'
40
+ @having_problems_text = having_problems_text || 'Having problems with this service?'
41
+ @contact_us_text = contact_us_text || 'for support.'
42
+ end
43
+
44
+ # Generates the HTML for the CCS Contact Us component
45
+ #
46
+ # @return [ActiveSupport::SafeBuffer]
47
+
48
+ def render
49
+ tag.div(**options[:attributes]) do
50
+ tag.div(class: 'govuk-width-container') do
51
+ tag.div(class: 'govuk-grid-row') do
52
+ tag.div(class: 'govuk-grid-column-full') do
53
+ tag.p(class: 'ccs-contact-us-body') do
54
+ concat(tag.strong(having_problems_text, class: 'ccs-contact-us-body__problems'))
55
+ concat(link_to(contact_us_link_text, contact_us_link_href, class: 'govuk-link', rel: 'noreferrer noopener', target: '_blank'))
56
+ concat(contact_us_text)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ # The default attributes for contact us
65
+
66
+ DEFAULT_ATTRIBUTES = { class: 'ccs-contact-us' }.freeze
67
+ end
68
+ end
69
+ end
70
+ end
@@ -9,7 +9,7 @@ module CCS
9
9
  # = CCS Footer
10
10
  #
11
11
  # This is used for generating the footer component from the
12
- # {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/footer CCS - Components - Footer}
12
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/footer CCS - Components - Footer}
13
13
  #
14
14
  # @!attribute [r] logo
15
15
  # @return [Logo] The initialised Logo component
@@ -9,7 +9,7 @@ module CCS
9
9
  # = CCS Header
10
10
  #
11
11
  # This is used for generating the header component from the
12
- # {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/header CCS - Components - Header}
12
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/header CCS - Components - Header}
13
13
  #
14
14
  # @!attribute [r] logo
15
15
  # @return [Logo] The initialised Logo component
@@ -6,7 +6,7 @@ module CCS
6
6
  # = CCS Logo
7
7
  #
8
8
  # This is used for generating the logo component from the
9
- # {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/logo CCS - Components - Logo}
9
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/logo CCS - Components - Logo}
10
10
 
11
11
  class Logo < Base
12
12
  # Generates the HTML for the CCS Logo.
@@ -0,0 +1,62 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module CCS
6
+ class PasswordStrength < Base
7
+ # = CCS Password Strength Test
8
+ #
9
+ # The individual test within the password strength list
10
+ #
11
+ # @!attribute [r] text
12
+ # @return [Symbol] Text for the tes
13
+
14
+ class Test < Base
15
+ private
16
+
17
+ attr_reader :text
18
+
19
+ public
20
+
21
+ # @param type [Symbol] The type of the test, one of: length, symbol, number, uppercase, lowercase
22
+ # @param text [String] Optional text for the test. If not given then a default will be used
23
+ # @param text [value] This is required if type is length and is the required length of the password.
24
+ # This is required if type is symbol and is the list of allowed symbols.
25
+
26
+ def initialize(context:, type:, text: nil, value: nil)
27
+ super(context: context, attributes: { data: { 'test-type': type } })
28
+
29
+ default_text = case type
30
+ when :length
31
+ @options[:attributes][:data]['test-value'] = value
32
+ "at least #{value} characters"
33
+ when :symbol
34
+ @options[:attributes][:data]['test-value'] = value
35
+ 'at least one symbol (eg ?, !, £, %)'
36
+ when :number
37
+ 'at least one number'
38
+ when :uppercase
39
+ 'at least one capital letter'
40
+ when :lowercase
41
+ 'at least one lowercase letter'
42
+ end
43
+
44
+ @text = text || default_text
45
+ end
46
+
47
+ # Generates the HTML for the CCS Password Strength Test
48
+ #
49
+ # @return [ActiveSupport::SafeBuffer]
50
+
51
+ def render
52
+ tag.li(text, **options[:attributes])
53
+ end
54
+
55
+ # The default attributes for the password strength test
56
+
57
+ DEFAULT_ATTRIBUTES = { class: 'ccs-password-strength-test' }.freeze
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,53 @@
1
+ require_relative '../base'
2
+ require_relative 'password_strength/test'
3
+
4
+ module CCS
5
+ module Components
6
+ module CCS
7
+ # = CCS Password Strength
8
+ #
9
+ # This is used for generating the contact us component from the
10
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/password-strength CCS - Components - Password strength}
11
+ #
12
+ # @!attribute [r] password_strength_tests
13
+ # @return [Array<Test>] An array of the initialised password strength tests
14
+
15
+ class PasswordStrength < Base
16
+ private
17
+
18
+ attr_reader :password_strength_tests
19
+
20
+ public
21
+
22
+ # @param password_id [String] The ID for the password element that will be checked against
23
+ # @param password_strength_tests [Array<Hash>] An array of options for the password strength tests,
24
+ # See {Components::CCS::PasswordStrength::Test#initialize Test#initialize} for details of the items in the array.
25
+ #
26
+ # @option options [String] :classes additional CSS classes for the password strength HTML
27
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
28
+
29
+ def initialize(password_id:, password_strength_tests:, **options)
30
+ super(**options)
31
+
32
+ @options[:attributes][:data][:target] = password_id
33
+
34
+ @password_strength_tests = password_strength_tests.map { |password_strength_test| Test.new(context: @context, **password_strength_test) }
35
+ end
36
+
37
+ # Generates the HTML for the CCS password strength component
38
+ #
39
+ # @return [ActiveSupport::SafeBuffer]
40
+
41
+ def render
42
+ tag.ul(**options[:attributes]) do
43
+ password_strength_tests.each { |password_strength_test| concat(password_strength_test.render) }
44
+ end
45
+ end
46
+
47
+ # The default attributes for password strength
48
+
49
+ DEFAULT_ATTRIBUTES = { class: 'ccs-password-strength', data: { module: 'ccs-password-strength' } }.freeze
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../components/ccs/contact_us'
4
+
5
+ module CCS
6
+ module FrontendHelpers
7
+ module CCSFrontend
8
+ # = CCS Contact Us
9
+ #
10
+ # This helper is used for generating the contact us component from the
11
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/contact-us CCS - Components - Contact Us}
12
+
13
+ module ContactUs
14
+ # Generates the HTML for the CCS Contact Us component
15
+ #
16
+ # @param (see CCS::Components::CCS::ContactUs#initialize)
17
+ #
18
+ # @option (see CCS::Components::CCS::ContactUs#initialize)
19
+ #
20
+ # @return (see CCS::Components::CCS::ContactUs#render)
21
+
22
+ def ccs_contact_us(contact_us_link_href, **options)
23
+ Components::CCS::ContactUs.new(contact_us_link_href: contact_us_link_href, context: self, **options).render
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -8,7 +8,7 @@ module CCS
8
8
  # = CCS Footer
9
9
  #
10
10
  # This helper is used for generating the footer component from the
11
- # {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/footer CCS - Components - Footer}
11
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/footer CCS - Components - Footer}
12
12
 
13
13
  module Footer
14
14
  # Generates the HTML for the CCS Footer component
@@ -8,7 +8,7 @@ module CCS
8
8
  # = CCS Header
9
9
  #
10
10
  # This helper is used for generating the header component from the
11
- # {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/header CCS - Components - Header}
11
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/header CCS - Components - Header}
12
12
 
13
13
  module Header
14
14
  # Generates the HTML for the CCS Header component
@@ -8,7 +8,7 @@ module CCS
8
8
  # = CCS Logo
9
9
  #
10
10
  # This helper is used for generating the logo component from the
11
- # {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/logo CCS - Components - Logo}
11
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/logo CCS - Components - Logo}
12
12
 
13
13
  module Logo
14
14
  # Generates the HTML for the CCS Logo component
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../components/ccs/password_strength'
4
+
5
+ module CCS
6
+ module FrontendHelpers
7
+ module CCSFrontend
8
+ # = CCS Password Strength
9
+ #
10
+ # This helper is used for generating the password strength component from the
11
+ # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/contact-us CCS - Components - Password Strength}
12
+
13
+ module PasswordStrength
14
+ # Generates the HTML for the CCS Password Strength component
15
+ #
16
+ # @param (see CCS::Components::CCS::PasswordStrength#initialize)
17
+ #
18
+ # @option (see CCS::Components::CCS::PasswordStrength#initialize)
19
+ #
20
+ # @return (see CCS::Components::CCS::PasswordStrength#render)
21
+
22
+ def ccs_password_strength(password_id, password_strength_tests, **options)
23
+ Components::CCS::PasswordStrength.new(password_id: password_id, password_strength_tests: password_strength_tests, context: self, **options).render
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'ccs_frontend/contact_us'
3
4
  require_relative 'ccs_frontend/dashboard_section'
4
5
  require_relative 'ccs_frontend/footer'
5
6
  require_relative 'ccs_frontend/header'
6
7
  require_relative 'ccs_frontend/logo'
8
+ require_relative 'ccs_frontend/password_strength'
7
9
 
8
10
  module CCS
9
11
  module FrontendHelpers
@@ -11,10 +13,12 @@ module CCS
11
13
  # These are a collection of view helpers to help render CCS components
12
14
 
13
15
  module CCSFrontend
16
+ include ContactUs
14
17
  include DashboardSection
15
18
  include Footer
16
19
  include Header
17
20
  include Logo
21
+ include PasswordStrength
18
22
  end
19
23
  end
20
24
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CCS
4
4
  module FrontendHelpers
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0.beta0'
6
6
  end
7
7
  end
data/package.json CHANGED
@@ -6,6 +6,6 @@
6
6
  "license": "MIT",
7
7
  "devDependencies": {
8
8
  "govuk-frontend": "^5.4.0",
9
- "ccs-frontend": "^1.0.0"
9
+ "ccs-frontend": "^1.1.0-beta.2"
10
10
  }
11
11
  }
data/yarn.lock CHANGED
@@ -2,10 +2,10 @@
2
2
  # yarn lockfile v1
3
3
 
4
4
 
5
- ccs-frontend@^1.0.0:
6
- version "1.0.0"
7
- resolved "https://registry.yarnpkg.com/ccs-frontend/-/ccs-frontend-1.0.0.tgz#88b53812894e10e5d3e546f54551f709d182c801"
8
- integrity sha512-a+bNJwGaAovEA3K764XkV2GoMMMWGGItqmvDzM46Nq0JXs1oat3CXjptZ01TxXFae6eg4YKWoUMCHbfMBiU6TA==
5
+ ccs-frontend@^1.1.0-beta.2:
6
+ version "1.1.0-beta.2"
7
+ resolved "https://registry.yarnpkg.com/ccs-frontend/-/ccs-frontend-1.1.0-beta.2.tgz#6d99e856a8c93fed0269e387f2da5b9101b4967a"
8
+ integrity sha512-JtdsweeoAIZhxGiO/KCmp9Pd6Rije0TOGAx7yP5/Sdgqbl+SffctX/SJlG4woUY0XK3mgglcHudjTBCGfBF+cg==
9
9
 
10
10
  govuk-frontend@^5.4.0:
11
11
  version "5.4.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ccs-frontend_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0.beta0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crown Commercial Service
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-07 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -41,6 +41,7 @@ files:
41
41
  - Rakefile
42
42
  - ccs-frontend_helpers.gemspec
43
43
  - lib/ccs/components/base.rb
44
+ - lib/ccs/components/ccs/contact_us.rb
44
45
  - lib/ccs/components/ccs/dashboard_section.rb
45
46
  - lib/ccs/components/ccs/dashboard_section/panel.rb
46
47
  - lib/ccs/components/ccs/footer.rb
@@ -52,6 +53,8 @@ files:
52
53
  - lib/ccs/components/ccs/header/navigation.rb
53
54
  - lib/ccs/components/ccs/header/service_authentication.rb
54
55
  - lib/ccs/components/ccs/logo.rb
56
+ - lib/ccs/components/ccs/password_strength.rb
57
+ - lib/ccs/components/ccs/password_strength/test.rb
55
58
  - lib/ccs/components/govuk/accordion.rb
56
59
  - lib/ccs/components/govuk/accordion/section.rb
57
60
  - lib/ccs/components/govuk/accordion/section/content.rb
@@ -148,10 +151,12 @@ files:
148
151
  - lib/ccs/components/govuk/warning_text.rb
149
152
  - lib/ccs/frontend_helpers.rb
150
153
  - lib/ccs/frontend_helpers/ccs_frontend.rb
154
+ - lib/ccs/frontend_helpers/ccs_frontend/contact_us.rb
151
155
  - lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb
152
156
  - lib/ccs/frontend_helpers/ccs_frontend/footer.rb
153
157
  - lib/ccs/frontend_helpers/ccs_frontend/header.rb
154
158
  - lib/ccs/frontend_helpers/ccs_frontend/logo.rb
159
+ - lib/ccs/frontend_helpers/ccs_frontend/password_strength.rb
155
160
  - lib/ccs/frontend_helpers/govuk_frontend.rb
156
161
  - lib/ccs/frontend_helpers/govuk_frontend/accordion.rb
157
162
  - lib/ccs/frontend_helpers/govuk_frontend/back_link.rb
@@ -217,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
222
  - !ruby/object:Gem::Version
218
223
  version: '0'
219
224
  requirements: []
220
- rubygems_version: 3.4.10
225
+ rubygems_version: 3.5.9
221
226
  signing_key:
222
227
  specification_version: 4
223
228
  summary: Gem containing view helpers for CCS Ruby on Rails projects