ccs-frontend_helpers 3.5.0 → 4.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +14 -8
- data/README.md +1 -0
- data/bun.lock +4 -4
- data/lib/ccs/components/ccs/footer.rb +1 -1
- data/lib/ccs/components/ccs/header.rb +1 -1
- data/lib/ccs/components/govuk/footer.rb +2 -3
- data/lib/ccs/components/govuk/header.rb +7 -31
- data/lib/ccs/components/govuk/logo.rb +7 -36
- data/lib/ccs/components/govuk/phase_banner.rb +1 -1
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- data/lib/ccs/frontend_helpers.rb +1 -1
- data/package.json +2 -2
- metadata +1 -3
- data/lib/ccs/components/govuk/header/link.rb +0 -56
- data/lib/ccs/components/govuk/header/navigation.rb +0 -73
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49646be5e9102840f23e97d929277451d84c657605ae3df6de9b71f98bb7257b
|
|
4
|
+
data.tar.gz: 9175d8a8ab1400f7b2f6f6b8dd738ec23764d05a940832cb9ce0025d753f2f29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c20e68cd8b64f663c3f7154008accd235ee39f51e27a311277f0a02cd59fe421062358a83b3754373806f54c1b6e31bdb85c08df106f295d6319d88ce596c098
|
|
7
|
+
data.tar.gz: 48d79cbd22737749075376c3b7a99d511b5f453ad1bd7c9543206ba516be5c977041813fb491f88c331c56233f4af74dac1ac2b4dcf94c9496f74d74c34fe136
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.0.0] - 2026-03-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Updated CCS Frontend to v3.0.0
|
|
15
|
+
- Updated GOV.UK Frontend to v6.1.0
|
|
16
|
+
- Updated CCS Frontend to v3.1.0
|
|
17
|
+
|
|
10
18
|
## [3.5.0] - 2026-02-02
|
|
11
19
|
|
|
12
20
|
### Added
|
data/Gemfile
CHANGED
|
@@ -16,7 +16,7 @@ gem 'simplecov', '~> 0.21'
|
|
|
16
16
|
gem 'nokogiri-diff', '~> 0.3.0'
|
|
17
17
|
|
|
18
18
|
# Gems for linting/formatting the package
|
|
19
|
-
gem 'rubocop', '~> 1.
|
|
19
|
+
gem 'rubocop', '~> 1.85'
|
|
20
20
|
gem 'rubocop-capybara', '~> 2.22'
|
|
21
21
|
gem 'rubocop-rails', '~> 2.34'
|
|
22
22
|
gem 'rubocop-rake', '~> 0.7'
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ccs-frontend_helpers (
|
|
4
|
+
ccs-frontend_helpers (4.0.0)
|
|
5
5
|
rails (>= 7.2)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -81,8 +81,8 @@ GEM
|
|
|
81
81
|
securerandom (>= 0.3)
|
|
82
82
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
83
83
|
uri (>= 0.13.1)
|
|
84
|
-
addressable (2.8.
|
|
85
|
-
public_suffix (>= 2.0.2, <
|
|
84
|
+
addressable (2.8.9)
|
|
85
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
86
86
|
ast (2.4.3)
|
|
87
87
|
base64 (0.3.0)
|
|
88
88
|
bigdecimal (4.0.1)
|
|
@@ -114,7 +114,10 @@ GEM
|
|
|
114
114
|
pp (>= 0.6.0)
|
|
115
115
|
rdoc (>= 4.0.0)
|
|
116
116
|
reline (>= 0.4.2)
|
|
117
|
-
json (2.
|
|
117
|
+
json (2.19.0)
|
|
118
|
+
json-schema (6.2.0)
|
|
119
|
+
addressable (~> 2.8)
|
|
120
|
+
bigdecimal (>= 3.1, < 5)
|
|
118
121
|
language_server-protocol (3.17.0.5)
|
|
119
122
|
lint_roller (1.1.0)
|
|
120
123
|
logger (1.7.0)
|
|
@@ -129,6 +132,8 @@ GEM
|
|
|
129
132
|
net-smtp
|
|
130
133
|
marcel (1.1.0)
|
|
131
134
|
matrix (0.4.2)
|
|
135
|
+
mcp (0.8.0)
|
|
136
|
+
json-schema (>= 4.1)
|
|
132
137
|
mini_mime (1.1.5)
|
|
133
138
|
minitest (6.0.1)
|
|
134
139
|
prism (~> 1.5)
|
|
@@ -152,7 +157,7 @@ GEM
|
|
|
152
157
|
nokogiri (~> 1.5)
|
|
153
158
|
tdiff (~> 0.4)
|
|
154
159
|
parallel (1.27.0)
|
|
155
|
-
parser (3.3.10.
|
|
160
|
+
parser (3.3.10.2)
|
|
156
161
|
ast (~> 2.4.1)
|
|
157
162
|
racc
|
|
158
163
|
pp (0.6.3)
|
|
@@ -162,7 +167,7 @@ GEM
|
|
|
162
167
|
psych (5.3.1)
|
|
163
168
|
date
|
|
164
169
|
stringio
|
|
165
|
-
public_suffix (
|
|
170
|
+
public_suffix (7.0.5)
|
|
166
171
|
racc (1.8.1)
|
|
167
172
|
rack (3.2.4)
|
|
168
173
|
rack-session (2.1.1)
|
|
@@ -224,10 +229,11 @@ GEM
|
|
|
224
229
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
225
230
|
rspec-support (~> 3.13.0)
|
|
226
231
|
rspec-support (3.13.6)
|
|
227
|
-
rubocop (1.
|
|
232
|
+
rubocop (1.85.1)
|
|
228
233
|
json (~> 2.3)
|
|
229
234
|
language_server-protocol (~> 3.17.0.2)
|
|
230
235
|
lint_roller (~> 1.1.0)
|
|
236
|
+
mcp (~> 0.6)
|
|
231
237
|
parallel (~> 1.10)
|
|
232
238
|
parser (>= 3.3.0.2)
|
|
233
239
|
rainbow (>= 2.2.2, < 4.0)
|
|
@@ -298,7 +304,7 @@ DEPENDENCIES
|
|
|
298
304
|
nokogiri-diff (~> 0.3.0)
|
|
299
305
|
rake (~> 13.3)
|
|
300
306
|
rspec (~> 3.13)
|
|
301
|
-
rubocop (~> 1.
|
|
307
|
+
rubocop (~> 1.85)
|
|
302
308
|
rubocop-capybara (~> 2.22)
|
|
303
309
|
rubocop-rails (~> 2.34)
|
|
304
310
|
rubocop-rake (~> 0.7)
|
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
|
+
| [4.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v4.0.0) | [6.1.0](https://github.com/alphagov/govuk-frontend/releases/tag/v6.1.0) | [3.1.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v3.1.0) |
|
|
17
18
|
| [3.5.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v3.5.0) | [5.14.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.14.0) | [2.5.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v2.5.0) |
|
|
18
19
|
| [3.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v3.4.0) | [5.14.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.14.0) | [2.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v2.4.0) |
|
|
19
20
|
| [3.3.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v3.3.0) | [5.13.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.13.0) | [2.3.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v2.3.0) |
|
data/bun.lock
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
"workspaces": {
|
|
5
5
|
"": {
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"ccs-frontend": "
|
|
8
|
-
"govuk-frontend": "
|
|
7
|
+
"ccs-frontend": "3.1.0",
|
|
8
|
+
"govuk-frontend": "6.1.0",
|
|
9
9
|
},
|
|
10
10
|
},
|
|
11
11
|
},
|
|
12
12
|
"packages": {
|
|
13
|
-
"ccs-frontend": ["ccs-frontend@
|
|
13
|
+
"ccs-frontend": ["ccs-frontend@3.1.0", "", { "peerDependencies": { "govuk-frontend": "^6.1.0", "jquery": "^4.x" } }, "sha512-5O/QVDt06qB6goQ1lXvI532WNRChxvFDUDT98oKcVQ6nHMsokAk2TYENmUlmTePUPo4tAqGx8OvyEIuR0Go02g=="],
|
|
14
14
|
|
|
15
|
-
"govuk-frontend": ["govuk-frontend@
|
|
15
|
+
"govuk-frontend": ["govuk-frontend@6.1.0", "", {}, "sha512-sqivexZFa82LiDIDVMItsUlqEXE/wEUWWBqzEoxHvUFLBH7bY0C8lVrj1qsDThSnj5JEUMS7isBAbKnfQ5Qp6g=="],
|
|
16
16
|
|
|
17
17
|
"jquery": ["jquery@3.7.1", "", {}, "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="],
|
|
18
18
|
}
|
|
@@ -53,7 +53,7 @@ module CCS
|
|
|
53
53
|
# @return [ActiveSupport::SafeBuffer]
|
|
54
54
|
|
|
55
55
|
def render
|
|
56
|
-
tag.
|
|
56
|
+
tag.div(**options[:attributes]) do
|
|
57
57
|
tag.div(class: "govuk-width-container #{options[:container_classes]}".rstrip) do
|
|
58
58
|
if navigation
|
|
59
59
|
concat(tag.div(class: 'ccs-footer__navigation') do
|
|
@@ -41,7 +41,7 @@ module CCS
|
|
|
41
41
|
# @return [ActiveSupport::SafeBuffer]
|
|
42
42
|
|
|
43
43
|
def render
|
|
44
|
-
tag.
|
|
44
|
+
tag.div(**options[:attributes]) do
|
|
45
45
|
concat(tag.div(class: "ccs-header__container #{options[:container_classes]}".rstrip) do
|
|
46
46
|
concat(header_logo)
|
|
47
47
|
end)
|
|
@@ -35,7 +35,6 @@ module CCS
|
|
|
35
35
|
# @option options [String] :container_class classes that can be added to the inner container
|
|
36
36
|
# @option options [ActiveSupport::SafeBuffer,String] :content_licence The content licence information, see {CCS::Components::GovUK::Footer#footer_content_licence footer_content_licence} for default
|
|
37
37
|
# @option options [ActiveSupport::SafeBuffer,String] :copyright The copyright information, (default: '© Crown copyright')
|
|
38
|
-
# @option options [Boolean] :rebrand flag to use the rebrand footer which includes the logo
|
|
39
38
|
# @option options [Hash] :attributes additional attributes that will added as part of the HTML
|
|
40
39
|
|
|
41
40
|
def initialize(navigation: nil, meta: nil, **)
|
|
@@ -43,7 +42,7 @@ module CCS
|
|
|
43
42
|
|
|
44
43
|
@options[:copyright] ||= '© Crown copyright'
|
|
45
44
|
|
|
46
|
-
@logo = Logo.new(
|
|
45
|
+
@logo = Logo.new(use_logotype: false, classes: 'govuk-footer__crown', context: @context)
|
|
47
46
|
@navigation = navigation&.map { |navigation_item| Navigation.new(context: @context, **navigation_item) }
|
|
48
47
|
@meta = Meta.new(context: @context, **meta) if meta
|
|
49
48
|
end
|
|
@@ -55,7 +54,7 @@ module CCS
|
|
|
55
54
|
# @return [ActiveSupport::SafeBuffer]
|
|
56
55
|
|
|
57
56
|
def render
|
|
58
|
-
tag.
|
|
57
|
+
tag.div(**options[:attributes]) do
|
|
59
58
|
tag.div(class: "govuk-width-container #{options[:container_classes]}".rstrip) do
|
|
60
59
|
concat(logo.render) if logo
|
|
61
60
|
if navigation.present?
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require_relative '../base'
|
|
2
|
-
require_relative 'header/navigation'
|
|
3
2
|
require_relative 'logo'
|
|
4
3
|
|
|
5
4
|
module CCS
|
|
@@ -38,20 +37,15 @@ module CCS
|
|
|
38
37
|
# @option options [String] :container_classes classes for the container
|
|
39
38
|
# @option options [String] :homepage_url URL of the homepage. Defaults to +/+
|
|
40
39
|
# @option options [String] :product_name product name, used when the product name follows on directly from ‘GOV.UK
|
|
41
|
-
# @option options [Boolean] :use_tudor_crown flag to use the new tudor crown for the GOV.UK Logo
|
|
42
|
-
# @option options [Boolean] :rebrand flag to use the rebrand logo
|
|
43
40
|
# @option options [Hash] :attributes additional attributes that will added as part of the header HTML
|
|
44
41
|
|
|
45
|
-
def initialize(
|
|
46
|
-
super
|
|
42
|
+
def initialize(**)
|
|
43
|
+
super
|
|
47
44
|
|
|
48
45
|
@options[:container_classes] ||= 'govuk-width-container'
|
|
49
|
-
@options[:homepage_url] ||= '
|
|
50
|
-
@options[:use_tudor_crown] = true if @options[:use_tudor_crown].nil?
|
|
46
|
+
@options[:homepage_url] ||= '//gov.uk'
|
|
51
47
|
|
|
52
|
-
@logo = Logo.new(
|
|
53
|
-
@navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items].present?
|
|
54
|
-
@service = service
|
|
48
|
+
@logo = Logo.new(classes: 'govuk-header__logotype', attributes: { aria: { label: 'GOV.UK' } }, context: @context)
|
|
55
49
|
end
|
|
56
50
|
|
|
57
51
|
# Generates the HTML for the GOV.UK Header component
|
|
@@ -59,22 +53,16 @@ module CCS
|
|
|
59
53
|
# @return [ActiveSupport::SafeBuffer]
|
|
60
54
|
|
|
61
55
|
def render
|
|
62
|
-
tag.
|
|
56
|
+
tag.div(**options[:attributes]) do
|
|
63
57
|
tag.div(class: "govuk-header__container #{options[:container_classes]}") do
|
|
64
58
|
concat(header_logo)
|
|
65
|
-
if service || navigation
|
|
66
|
-
concat(tag.div(class: 'govuk-header__content') do
|
|
67
|
-
concat(header_service_name) if service
|
|
68
|
-
concat(navigation.render) if navigation
|
|
69
|
-
end)
|
|
70
|
-
end
|
|
71
59
|
end
|
|
72
60
|
end
|
|
73
61
|
end
|
|
74
62
|
|
|
75
63
|
# The default attributes for the breadcrumbs
|
|
76
64
|
|
|
77
|
-
DEFAULT_ATTRIBUTES = { class: 'govuk-header'
|
|
65
|
+
DEFAULT_ATTRIBUTES = { class: 'govuk-header' }.freeze
|
|
78
66
|
|
|
79
67
|
private
|
|
80
68
|
|
|
@@ -84,24 +72,12 @@ module CCS
|
|
|
84
72
|
|
|
85
73
|
def header_logo
|
|
86
74
|
tag.div(class: 'govuk-header__logo') do
|
|
87
|
-
link_to(options[:homepage_url], class: 'govuk-
|
|
75
|
+
link_to(options[:homepage_url], class: 'govuk-header__homepage-link') do
|
|
88
76
|
concat(logo.render)
|
|
89
77
|
concat(tag.span(options[:product_name], class: 'govuk-header__product-name')) if options[:product_name]
|
|
90
78
|
end
|
|
91
79
|
end
|
|
92
80
|
end
|
|
93
|
-
|
|
94
|
-
# Generates the service name section
|
|
95
|
-
#
|
|
96
|
-
# @return [ActiveSupport::SafeBuffer]
|
|
97
|
-
|
|
98
|
-
def header_service_name
|
|
99
|
-
if service[:href]
|
|
100
|
-
link_to(service[:name], service[:href], class: 'govuk-header__link govuk-header__service-name')
|
|
101
|
-
else
|
|
102
|
-
tag.span(service[:name], class: 'govuk-header__service-name')
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
81
|
end
|
|
106
82
|
end
|
|
107
83
|
end
|
|
@@ -8,12 +8,8 @@ module CCS
|
|
|
8
8
|
# This is used to generate the logo component from the
|
|
9
9
|
# {https://github.com/alphagov/govuk-frontend/blob/main/packages/govuk-frontend/src/govuk/macros/logo.njk GDS - Macros - Logo}
|
|
10
10
|
#
|
|
11
|
-
# @!attribute [r] rebrand
|
|
12
|
-
# @return [Boolean] flag for rebrand
|
|
13
11
|
# @!attribute [r] use_logotype
|
|
14
12
|
# @return [Boolean] flag for logotype
|
|
15
|
-
# @!attribute [r] use_tudor_crown
|
|
16
|
-
# @return [Boolean] flag for tudor crown
|
|
17
13
|
|
|
18
14
|
class Logo < Base
|
|
19
15
|
include ActionView::Context
|
|
@@ -21,27 +17,23 @@ module CCS
|
|
|
21
17
|
|
|
22
18
|
private
|
|
23
19
|
|
|
24
|
-
attr_reader :
|
|
20
|
+
attr_reader :use_logotype
|
|
25
21
|
|
|
26
22
|
public
|
|
27
23
|
|
|
28
|
-
# @param rebrand [Boolean] Flag for rebrand
|
|
29
24
|
# @param use_logotype [Boolean] Flag for logotyp
|
|
30
|
-
# @param use_tudor_crown [Boolean] Flag for tudor crown
|
|
31
25
|
# @param options [Hash] options that will be used in customising the HTML
|
|
32
26
|
#
|
|
33
27
|
# @option options [String] :classes additional CSS classes for the logo HTML
|
|
34
28
|
# @option options [Hash] :attributes additional attributes that will added as part of the logo HTML
|
|
35
29
|
|
|
36
|
-
def initialize(
|
|
30
|
+
def initialize(use_logotype: true, **)
|
|
37
31
|
super(**)
|
|
38
32
|
|
|
39
|
-
@rebrand = rebrand
|
|
40
33
|
@use_logotype = use_logotype
|
|
41
|
-
@use_tudor_crown = rebrand ? true : use_tudor_crown
|
|
42
34
|
|
|
43
|
-
svg_width =
|
|
44
|
-
svg_width
|
|
35
|
+
svg_width = 32
|
|
36
|
+
svg_width += 130 if @use_logotype
|
|
45
37
|
|
|
46
38
|
@options[:attributes][:focusable] = 'false'
|
|
47
39
|
@options[:attributes][:role] = @options[:attributes].dig(:aria, :label) ? 'img' : 'presentation'
|
|
@@ -59,8 +51,8 @@ module CCS
|
|
|
59
51
|
def render
|
|
60
52
|
tag.svg(**options[:attributes]) do
|
|
61
53
|
concat(tag.title(@options[:attributes].dig(:aria, :label))) if @options[:attributes].dig(:aria, :label)
|
|
62
|
-
concat(
|
|
63
|
-
concat(
|
|
54
|
+
concat(tudor_crown)
|
|
55
|
+
concat(logotype) if use_logotype
|
|
64
56
|
end
|
|
65
57
|
end
|
|
66
58
|
|
|
@@ -70,14 +62,6 @@ module CCS
|
|
|
70
62
|
|
|
71
63
|
private
|
|
72
64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2-5.4,6.4-7.2,6-2.4-.4-3.4-2.6-3-4.4.6-2.6,3.2-3.2,4.4-.2,2.4-4.8-1.6-6.2-4.2-4.8,3.8-3.8,4.4-7.2,1.2-11.4-4.4,3.4-4.4,6.6-2.4,11.2-2.6-3-6.6-1.4-5,3.4,1.8-2.8,4.2-1,4,1.6-.4,2.4-3.4,4.2-7.4,4-5.6-.4-6-4.4-6-7.4,1.4-.2,3.8,1,6,4l.8-8.8c-2.2,2.4-4.4,2.8-6.6,2.8.8-2.4,4.2-6.2,4.2-6.2h-11s3.6,4,4.2,6.2c-2.2,0-4.4-.6-6.6-2.8l.8,8.8c2.2-3,4.6-4.2,6-4-.2,3.2-.4,7-6,7.4-3.8.4-7-1.6-7.4-4-.4-2.6,2-4.4,3.8-1.6,1.4-4.8-2.6-6.2-5.2-3.4,2-4.6,2-8-2.4-11.2-3.2,4.2-2.6,7.6,1.2,11.4-2.6-1.4-6.4,0-4.2,4.8,1.2-3,3.8-2.2,4.4.2.4,1.8-.8,3.8-3,4.4-2,.4-5-1-7.4-6,1.4,0,2.6.8,4,1.8l-3-8.4c-.6,2.4-1.4,3.8-2.4,4.8-.6-1.6-.4-3,0-5.6l-5.2,1.8c3,3.8,5.6,9,7.8,18.2,7.6-1,16.4-1.8,25.4-1.8')
|
|
79
|
-
end
|
|
80
|
-
|
|
81
65
|
# rubocop:disable Metrics/AbcSize
|
|
82
66
|
|
|
83
67
|
# Generates the Tudor Crown HTML
|
|
@@ -100,24 +84,11 @@ module CCS
|
|
|
100
84
|
|
|
101
85
|
# rubocop:enable Metrics/AbcSize
|
|
102
86
|
|
|
103
|
-
# Generates the HTML for logotype with standard dot
|
|
104
|
-
#
|
|
105
|
-
# @return [ActiveSupport::SafeBuffer]
|
|
106
|
-
|
|
107
|
-
def logotype
|
|
108
|
-
path_kwargs = {
|
|
109
|
-
d: 'M88.6,33.2c0,1.8.2,3.4.6,5s1.2,3,2,4.4c1,1.2,2,2.2,3.4,3s3,1.2,5,1.2,3.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8-5.4.4-1.6,1.2-3.2,2.2-4.4,1-1.2,2.2-2.2,3.4-2.8,1.4-.6,3-1,4.8-1s3.4.4,4.8,1,2.6,1.6,3.4,2.8c1,1.2,1.6,2.6,2.2,4.4.4,1.6.8,3.4.8,5.4v.2ZM177.8,54l-11.8-42h9.4l8,31.4h.2l8-31.4h9.4l-11.8,42h-11.4,0ZM235.4,46.7c1.2,0,2.4-.2,3.4-.6,1-.4,2-.8,2.8-1.6s1.4-1.6,1.8-2.8c.4-1.2.6-2.4.6-4V11.8h8.2v27.2c0,2.4-.4,4.4-1.2,6.2s-2,3.4-3.6,4.8c-1.4,1.4-3.2,2.4-5.4,3-2,.8-4.4,1-6.8,1s-4.8-.4-6.8-1c-2-.8-3.8-1.8-5.4-3-1.6-1.4-2.6-3-3.6-4.8-.8-1.8-1.2-4-1.2-6.2V11.7h8.4v26c0,1.6.2,2.8.6,4,.4,1.2,1,2,1.8,2.8s1.6,1.2,2.8,1.6c1.2.4,2.2.6,3.6.6h0ZM261.4,11.9h8.4v18.2l14.8-18.2h10.4l-14.4,16.8,15.4,25.2h-9.8l-11-18.8-5.4,6v12.8h-8.4V11.9h0ZM206.2,44.2c-3,0-5.4,2.4-5.4,5.4s2.4,5.4,5.4,5.4,5.4-2.4,5.4-5.4-2.4-5.4-5.4-5.4Z'
|
|
110
|
-
}
|
|
111
|
-
path_kwargs[:transform] = 'translate(8 0)' unless use_tudor_crown
|
|
112
|
-
|
|
113
|
-
tag.path(**path_kwargs)
|
|
114
|
-
end
|
|
115
|
-
|
|
116
87
|
# Generates the HTML for logotype with raised and coloured dot
|
|
117
88
|
#
|
|
118
89
|
# @return [ActiveSupport::SafeBuffer]
|
|
119
90
|
|
|
120
|
-
def
|
|
91
|
+
def logotype
|
|
121
92
|
capture do
|
|
122
93
|
concat(tag.circle(class: 'govuk-logo-dot', cx: '226', cy: '36', r: '7.3'))
|
|
123
94
|
concat(tag.path(d: 'M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9'))
|
data/lib/ccs/frontend_helpers.rb
CHANGED
|
@@ -10,7 +10,7 @@ module CCS
|
|
|
10
10
|
#
|
|
11
11
|
# The CCS Frontend Helperss module contains view helpers based on:
|
|
12
12
|
# - {https://design-system.service.gov.uk/components GDS components}
|
|
13
|
-
# - {https://github.com/
|
|
13
|
+
# - {https://github.com/Crown-Commercial-Service/ccs-frontend-project CCS components}
|
|
14
14
|
# that can be used in Ruby on Rails projects within CCS.
|
|
15
15
|
|
|
16
16
|
module FrontendHelpers
|
data/package.json
CHANGED
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:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Crown Commercial Service
|
|
@@ -99,8 +99,6 @@ files:
|
|
|
99
99
|
- lib/ccs/components/govuk/footer/navigation.rb
|
|
100
100
|
- lib/ccs/components/govuk/form_group.rb
|
|
101
101
|
- lib/ccs/components/govuk/header.rb
|
|
102
|
-
- lib/ccs/components/govuk/header/link.rb
|
|
103
|
-
- lib/ccs/components/govuk/header/navigation.rb
|
|
104
102
|
- lib/ccs/components/govuk/hint.rb
|
|
105
103
|
- lib/ccs/components/govuk/inset_text.rb
|
|
106
104
|
- lib/ccs/components/govuk/label.rb
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
require_relative '../../base'
|
|
2
|
-
|
|
3
|
-
module CCS
|
|
4
|
-
module Components
|
|
5
|
-
module GovUK
|
|
6
|
-
class Header < Base
|
|
7
|
-
# = GOV.UK 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] href
|
|
14
|
-
# @return [String] The href for the header link
|
|
15
|
-
|
|
16
|
-
class Link < Base
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
attr_reader :text, :href
|
|
20
|
-
|
|
21
|
-
public
|
|
22
|
-
|
|
23
|
-
# @param text [String] the text for the header link
|
|
24
|
-
# @param href [String] the href for the header link
|
|
25
|
-
# @param options [Hash] options that will be used in customising the HTML
|
|
26
|
-
#
|
|
27
|
-
# @option options [Boolean] :active flag to mark the navigation item as active or not
|
|
28
|
-
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
|
29
|
-
|
|
30
|
-
def initialize(text:, href: nil, **)
|
|
31
|
-
super(**)
|
|
32
|
-
|
|
33
|
-
@text = text
|
|
34
|
-
@href = href
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Generates the HTML for the GOV.UK Header link
|
|
38
|
-
#
|
|
39
|
-
# @return [ActiveSupport::SafeBuffer]
|
|
40
|
-
|
|
41
|
-
def render
|
|
42
|
-
tag.li(class: "govuk-header__navigation-item #{'govuk-header__navigation-item--active' if options[:active]}".rstrip) do
|
|
43
|
-
if href
|
|
44
|
-
options[:attributes][:class] = 'govuk-header__link'
|
|
45
|
-
|
|
46
|
-
link_to(text, href, **options[:attributes])
|
|
47
|
-
else
|
|
48
|
-
text
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
require_relative 'link'
|
|
2
|
-
|
|
3
|
-
module CCS
|
|
4
|
-
module Components
|
|
5
|
-
module GovUK
|
|
6
|
-
class Header < Base
|
|
7
|
-
# = GOV.UK Header navigation
|
|
8
|
-
#
|
|
9
|
-
# The header navigation section
|
|
10
|
-
#
|
|
11
|
-
# @!attribute [r] navigation_links
|
|
12
|
-
# @return [Array<Link>] An array of the initialised navigation links
|
|
13
|
-
# @!attribute [r] navigation_label
|
|
14
|
-
# @return [String] The aria label for the navigation
|
|
15
|
-
# @!attribute [r] navigation_classes
|
|
16
|
-
# @return [String] The classes for the navigation
|
|
17
|
-
# @!attribute [r] menu_button
|
|
18
|
-
# @return [Hash] The options for the menu button
|
|
19
|
-
|
|
20
|
-
class Navigation
|
|
21
|
-
include ActionView::Context
|
|
22
|
-
include ActionView::Helpers
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
attr_reader :navigation_links, :navigation_label, :navigation_classes, :menu_button
|
|
27
|
-
|
|
28
|
-
public
|
|
29
|
-
|
|
30
|
-
# @param navigation [Hash] options for the navigation
|
|
31
|
-
# @param context [ActionView::Base] the view context
|
|
32
|
-
# @param menu_button [Hash] options for the menu button
|
|
33
|
-
#
|
|
34
|
-
# @option navigation [Array] :items an array of links for the navigation section.
|
|
35
|
-
# See {Components::GovUK::Header::Link#initialize Link#initialize} for details of the items in the array.
|
|
36
|
-
# @option navigation [String] :classes additional CSS classes for the navigation HTML
|
|
37
|
-
# @option navigation [String] :label text for the aria-label attribute of the navigation. Defaults to the menu button text
|
|
38
|
-
#
|
|
39
|
-
# @option menu_button [String] :text text for the button that opens the mobile navigation menu.
|
|
40
|
-
# By default, this is set to +Menu+.
|
|
41
|
-
# @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
|
|
42
|
-
# Defaults to +Show or hide menu+.
|
|
43
|
-
|
|
44
|
-
def initialize(navigation:, context:, menu_button: nil)
|
|
45
|
-
menu_button ||= {}
|
|
46
|
-
menu_button[:text] ||= 'Menu'
|
|
47
|
-
|
|
48
|
-
menu_button[:aria] = { controls: 'navigation' }
|
|
49
|
-
menu_button[:aria][:label] = menu_button[:label] if menu_button[:label]
|
|
50
|
-
|
|
51
|
-
@menu_button = menu_button
|
|
52
|
-
@navigation_links = navigation[:items].map { |navigation_link| Link.new(context: context, **navigation_link) }
|
|
53
|
-
@navigation_label = navigation[:label] || menu_button[:text]
|
|
54
|
-
@navigation_classes = "govuk-header__navigation #{navigation[:classes]}".rstrip
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# Generates the HTML for the GOV.UK Navigation
|
|
58
|
-
#
|
|
59
|
-
# @return [ActiveSupport::SafeBuffer]
|
|
60
|
-
|
|
61
|
-
def render
|
|
62
|
-
tag.nav(aria: { label: navigation_label }, class: navigation_classes) do
|
|
63
|
-
concat(button_tag(menu_button[:text], type: :button, class: 'govuk-header__menu-button govuk-js-header-toggle', aria: menu_button[:aria], hidden: true))
|
|
64
|
-
concat(tag.ul(id: 'navigation', class: 'govuk-header__navigation-list') do
|
|
65
|
-
navigation_links.each { |navigation_link| concat(navigation_link.render) }
|
|
66
|
-
end)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|