ccs-frontend_helpers 0.4.0 → 0.5.0.beta1
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 +92 -77
- data/Gemfile +1 -1
- data/Gemfile.lock +9 -9
- data/LICENSE.txt +1 -1
- data/README.md +43 -10
- data/ccs-frontend_helpers.gemspec +2 -3
- data/lib/ccs/components/ccs/dashboard_section/panel.rb +5 -1
- data/lib/ccs/components/ccs/footer/meta.rb +2 -2
- data/lib/ccs/components/ccs/footer.rb +7 -4
- data/lib/ccs/components/ccs/header/navigation.rb +2 -1
- data/lib/ccs/components/ccs/header.rb +7 -4
- data/lib/ccs/components/ccs/logo.rb +4 -7
- data/lib/ccs/components/govuk/field/input/file_upload.rb +1 -5
- data/lib/ccs/components/govuk/field/input/select.rb +1 -1
- data/lib/ccs/components/govuk/field/input/textarea.rb +1 -1
- data/lib/ccs/components/govuk/field/input.rb +1 -1
- data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +2 -2
- data/lib/ccs/components/govuk/pagination/increment/next.rb +1 -1
- data/lib/ccs/components/govuk/pagination/increment/previous.rb +1 -1
- data/lib/ccs/components/govuk/pagination/item/form.rb +1 -1
- data/lib/ccs/components/govuk/pagination/item/tag.rb +1 -1
- data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +1 -1
- data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +1 -1
- data/lib/ccs/frontend_helpers/ccs_frontend/logo.rb +24 -0
- data/lib/ccs/frontend_helpers/ccs_frontend.rb +2 -0
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- data/package.json +2 -1
- data/yarn.lock +5 -0
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 722e42a0b6590c17be63a46678cdcc8fe242aa296ffb4d0a9db4daabdde7a072
|
4
|
+
data.tar.gz: c7d20fb3f29d5312a0346e90340f8a133bbfaf3388f915cf408a637d9eec2006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51b61a7315924d8b3c8acc2f39e0936424f10f2a98e6ace651551573095e51a75b84d7e2155a43fdee4afb76d1144acfe8e5e87328e60086fa7a4247e3381f0e
|
7
|
+
data.tar.gz: f1ed0e45e3128214ededdc1228245af162100826f1b2095200ab78c7f27a6036ce1f20e46509735f0e4e88885787f9588bf3fdd6242f3daf064bb8291f0fc2a5
|
data/CHANGELOG.md
CHANGED
@@ -1,100 +1,115 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
7
|
|
7
|
-
|
8
|
+
## [Unreleased]
|
8
9
|
|
9
|
-
|
10
|
+
## [0.5.0.beta1] - 2024-06-07
|
10
11
|
|
11
|
-
|
12
|
+
### Changed
|
12
13
|
|
13
|
-
-
|
14
|
+
- Internal change to use CCS Frontend fixtures to test the CCS frontend components.
|
15
|
+
This included some minor changes to the HTML for the components.
|
14
16
|
|
15
|
-
## [0.
|
16
|
-
|
17
|
-
### 💥 Breaking changes
|
17
|
+
## [0.4.0] - 2024-05-20
|
18
18
|
|
19
|
-
|
19
|
+
### Added
|
20
20
|
|
21
|
-
|
22
|
-
```ruby
|
23
|
-
{
|
24
|
-
ellipsis: true
|
25
|
-
}
|
26
|
-
```
|
27
|
-
instead of:
|
28
|
-
```ruby
|
29
|
-
{
|
30
|
-
type: :ellipsis
|
31
|
-
}
|
32
|
-
```
|
21
|
+
- Update components to be compatible with GOV.UK Frontend v5.4
|
33
22
|
|
34
|
-
|
23
|
+
## [0.3.0] - 2024-04-12
|
35
24
|
|
36
|
-
|
25
|
+
### Added
|
37
26
|
|
38
|
-
|
27
|
+
- Update components to be compatible with GOV.UK Frontend v5.3
|
28
|
+
- The following GOV.UK helpers have been added:
|
29
|
+
- Password input
|
39
30
|
|
40
|
-
|
31
|
+
## [0.2.0] - 2024-03-13
|
41
32
|
|
42
|
-
|
43
|
-
|
33
|
+
### Changed
|
34
|
+
|
35
|
+
- Update components to be compatible with GOV.UK Frontend v5.2
|
36
|
+
- For pagination, the option to enable ellipsis is now:
|
37
|
+
```ruby
|
38
|
+
{
|
39
|
+
ellipsis: true
|
40
|
+
}
|
41
|
+
```
|
42
|
+
instead of:
|
43
|
+
```ruby
|
44
|
+
{
|
45
|
+
type: :ellipsis
|
46
|
+
}
|
47
|
+
```
|
48
|
+
- Add tests for GOV.UK Frontend fixtures
|
49
|
+
|
50
|
+
### Added
|
51
|
+
|
52
|
+
- The following GOV.UK helpers have been added:
|
53
|
+
- Exit this page
|
54
|
+
- Task list
|
44
55
|
|
45
56
|
## [0.1.2] - 2023-11-16
|
46
57
|
|
47
|
-
|
48
|
-
|
58
|
+
### Fixed
|
59
|
+
|
60
|
+
- Fix issue with radios component which, when passed a model or form, would treat the value as an array.
|
61
|
+
This did not cause an issue for strings as the `include?` method still works for them but if the value was a boolean or a number then an error would be thrown.
|
49
62
|
|
50
63
|
## [0.1.1] - 2023-10-25
|
51
64
|
|
52
|
-
|
65
|
+
### Fixed
|
66
|
+
|
67
|
+
- Fix some bugs with various helpers and update dependencies
|
53
68
|
|
54
69
|
## [0.1.0] - 2023-02-22
|
55
70
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
- Error
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
- Dashboard Panels
|
98
|
-
- Logo
|
99
|
-
- Header
|
100
|
-
- Footer
|
71
|
+
### Added
|
72
|
+
|
73
|
+
- Initial release of CCS Frontend Helpers.
|
74
|
+
This release contains view helpers that are used to create GOV.UK and CCS components.
|
75
|
+
|
76
|
+
- The following GOV.UK helpers have been added:
|
77
|
+
- Accordion
|
78
|
+
- Back link
|
79
|
+
- Breadcrumbs
|
80
|
+
- Button
|
81
|
+
- Character count
|
82
|
+
- Checkboxes
|
83
|
+
- Cookie banner
|
84
|
+
- Date input
|
85
|
+
- Details
|
86
|
+
- Error message
|
87
|
+
- Error summary
|
88
|
+
- Fieldset
|
89
|
+
- File upload
|
90
|
+
- Footer
|
91
|
+
- Form group
|
92
|
+
- Header
|
93
|
+
- Hint
|
94
|
+
- Inset text
|
95
|
+
- Notification banner
|
96
|
+
- Pagination
|
97
|
+
- Panel
|
98
|
+
- Phase banner
|
99
|
+
- Radios
|
100
|
+
- Select
|
101
|
+
- Skip link
|
102
|
+
- Step by step navigation
|
103
|
+
- Summary list
|
104
|
+
- Table
|
105
|
+
- Tabs
|
106
|
+
- Tag
|
107
|
+
- Text input
|
108
|
+
- Textarea
|
109
|
+
- Warning text
|
110
|
+
|
111
|
+
- The following CCS helpers have been added:
|
112
|
+
- Dashboard Panels
|
113
|
+
- Logo
|
114
|
+
- Header
|
115
|
+
- Footer
|
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.64'
|
20
20
|
gem 'rubocop-rails', '~> 2.25'
|
21
21
|
gem 'rubocop-rake', '~> 0.6'
|
22
22
|
gem 'rubocop-rspec', '~> 2.29'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ccs-frontend_helpers (0.
|
4
|
+
ccs-frontend_helpers (0.5.0.beta1)
|
5
5
|
rails (>= 6.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -86,7 +86,7 @@ GEM
|
|
86
86
|
ast (2.4.2)
|
87
87
|
base64 (0.2.0)
|
88
88
|
bigdecimal (3.1.8)
|
89
|
-
builder (3.
|
89
|
+
builder (3.3.0)
|
90
90
|
capybara (3.40.0)
|
91
91
|
addressable
|
92
92
|
matrix
|
@@ -127,7 +127,7 @@ GEM
|
|
127
127
|
mini_mime (1.1.5)
|
128
128
|
minitest (5.23.0)
|
129
129
|
mutex_m (0.2.0)
|
130
|
-
net-imap (0.4.
|
130
|
+
net-imap (0.4.12)
|
131
131
|
date
|
132
132
|
net-protocol
|
133
133
|
net-pop (0.1.2)
|
@@ -145,7 +145,7 @@ GEM
|
|
145
145
|
nokogiri (~> 1.5)
|
146
146
|
tdiff (~> 0.4)
|
147
147
|
parallel (1.24.0)
|
148
|
-
parser (3.3.
|
148
|
+
parser (3.3.2.0)
|
149
149
|
ast (~> 2.4.1)
|
150
150
|
racc
|
151
151
|
psych (5.1.2)
|
@@ -191,10 +191,10 @@ GEM
|
|
191
191
|
zeitwerk (~> 2.6)
|
192
192
|
rainbow (3.1.1)
|
193
193
|
rake (13.2.1)
|
194
|
-
rdoc (6.
|
194
|
+
rdoc (6.7.0)
|
195
195
|
psych (>= 4.0.0)
|
196
196
|
regexp_parser (2.9.2)
|
197
|
-
reline (0.5.
|
197
|
+
reline (0.5.8)
|
198
198
|
io-console (~> 0.5)
|
199
199
|
rexml (3.2.8)
|
200
200
|
strscan (>= 3.0.9)
|
@@ -211,7 +211,7 @@ GEM
|
|
211
211
|
diff-lcs (>= 1.2.0, < 2.0)
|
212
212
|
rspec-support (~> 3.13.0)
|
213
213
|
rspec-support (3.13.1)
|
214
|
-
rubocop (1.
|
214
|
+
rubocop (1.64.1)
|
215
215
|
json (~> 2.3)
|
216
216
|
language_server-protocol (>= 3.17.0)
|
217
217
|
parallel (~> 1.10)
|
@@ -264,7 +264,7 @@ GEM
|
|
264
264
|
xpath (3.2.0)
|
265
265
|
nokogiri (~> 1.8)
|
266
266
|
yard (0.9.36)
|
267
|
-
zeitwerk (2.6.
|
267
|
+
zeitwerk (2.6.15)
|
268
268
|
|
269
269
|
PLATFORMS
|
270
270
|
x86_64-darwin-19
|
@@ -278,7 +278,7 @@ DEPENDENCIES
|
|
278
278
|
nokogiri-diff (~> 0.3.0)
|
279
279
|
rake (~> 13.2)
|
280
280
|
rspec (~> 3.13)
|
281
|
-
rubocop (~> 1.
|
281
|
+
rubocop (~> 1.64)
|
282
282
|
rubocop-rails (~> 2.25)
|
283
283
|
rubocop-rake (~> 0.6)
|
284
284
|
rubocop-rspec (~> 2.29)
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CCS Frontend Helpers
|
2
2
|
|
3
|
-
[](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/actions/workflows/main.yml)
|
4
4
|
[](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.
|
@@ -12,12 +12,12 @@ This project contains two applications (both use the Ruby on Rails framework):
|
|
12
12
|
|
13
13
|
The following table shows the version of CCS Frontend Helpers that you should use for your targeted version of GOV.UK Frontend:
|
14
14
|
|
15
|
-
| CCS Frontend Helpers Version
|
16
|
-
| ----------------------------- | ------------------------------ |
|
17
|
-
| [0.4.0](https://github.com/
|
18
|
-
| [0.3.0](https://github.com/
|
19
|
-
| [0.2.0](https://github.com/
|
20
|
-
| [0.1.2](https://github.com/
|
15
|
+
| CCS Frontend Helpers Version | Target GOV.UK Frontend Version | Target CCS Frontend Version |
|
16
|
+
| ----------------------------- | ------------------------------ | --------------------------- |
|
17
|
+
| [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) | [1.0.0-beta.5](https://github.com/tim-s-ccs/ccs-frontend-project/releases/tag/v1.0.0-beta.5) |
|
18
|
+
| [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) | [1.0.0-beta.5](https://github.com/tim-s-ccs/ccs-frontend-project/releases/tag/v1.0.0-beta.5) |
|
19
|
+
| [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) | [1.0.0-beta.5](https://github.com/tim-s-ccs/ccs-frontend-project/releases/tag/v1.0.0-beta.5) |
|
20
|
+
| [0.1.2](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v0.1.2) | [4.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.7.0) | [1.0.0-beta.5](https://github.com/tim-s-ccs/ccs-frontend-project/releases/tag/v1.0.0-beta.5) |
|
21
21
|
|
22
22
|
Any other versions of GOV.UK Frontend not shown above _may_ still be compatible, but have not been specifically tested and verified.
|
23
23
|
|
@@ -45,7 +45,7 @@ module ApplicationHelper
|
|
45
45
|
end
|
46
46
|
```
|
47
47
|
|
48
|
-
This will give you access to a variety of [GDS components](https://design-system.service.gov.uk/components) and [CCS components](https://github.com/
|
48
|
+
This will give you access to a variety of [GDS components](https://design-system.service.gov.uk/components) and [CCS components](https://github.com/Crown-Commercial-Service/ts-ccs-frontend) to use in your application views.
|
49
49
|
The `GovUKFrontend` components are based on the components found in [GOV.UK Frontend v4.5.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.5.0).
|
50
50
|
|
51
51
|
Documentation for the helper methods can be found at [LINK TO RDOCS](#)
|
@@ -54,7 +54,7 @@ Documentation for the helper methods can be found at [LINK TO RDOCS](#)
|
|
54
54
|
|
55
55
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
56
56
|
|
57
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
57
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
58
58
|
|
59
59
|
### Linting
|
60
60
|
|
@@ -93,9 +93,42 @@ We schedule `dependabot` to run every Sunday night which will get the latest dep
|
|
93
93
|
|
94
94
|
Snyk is used more for analysing security issues and it will raise PRs itself for a developer to analyse.
|
95
95
|
|
96
|
+
## Releasing
|
97
|
+
|
98
|
+
1. Check out the **main** branch and pull the latest changes.
|
99
|
+
|
100
|
+
2. Update the version number in `version.rb` (we follow [Semantic Versioning](https://semver.org/)).
|
101
|
+
|
102
|
+
3. Run `bundle install` to update the `Gemfile.lock`
|
103
|
+
|
104
|
+
4. Create and check out a new branch (`release-[version]`)
|
105
|
+
|
106
|
+
```shell
|
107
|
+
git switch -c "release-$(./bin/version)"
|
108
|
+
```
|
109
|
+
|
110
|
+
5. Update the [`CHANGELOG.md`](/CHANGELOG.md) by:
|
111
|
+
|
112
|
+
- changing the 'Unreleased' heading to the new version number and release type. For example, '3.11.0 (Feature release)'
|
113
|
+
- adding a new 'Unreleased' heading above the new version number and release type, so users will know where to add PRs to the changelog
|
114
|
+
- if the changelog has headings from a pre release, regroup the content under those headings in a single block
|
115
|
+
- saving your changes
|
116
|
+
|
117
|
+
6. Run `./bin/build-release.sh` to:
|
118
|
+
|
119
|
+
- commit the changes
|
120
|
+
- push a branch to GitHub
|
121
|
+
|
122
|
+
You will now be prompted to continue or cancel. Check the details and enter `y` to continue. If something does not look right, press `N` to cancel the build and creation of the branch on GitHub.
|
123
|
+
|
124
|
+
7. Create a pull request and copy the changelog text.
|
125
|
+
When reviewing the PR, check that the version numbers have been updated and that the compiled assets use this version number.
|
126
|
+
|
127
|
+
8. Once a reviewer approves the pull request, merge it to **main**. The gem will then automatically be published to [rubygems.org](https://rubygems.org) via a GitHub action.
|
128
|
+
|
96
129
|
## Contributing
|
97
130
|
|
98
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
131
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Crown-Commercial-Service/ccs-frontend_helpers.
|
99
132
|
|
100
133
|
To contribute to the project, you should checkout a new branch from `main` and make your changes.
|
101
134
|
|
@@ -5,12 +5,11 @@ require_relative 'lib/ccs/frontend_helpers/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'ccs-frontend_helpers'
|
7
7
|
spec.version = CCS::FrontendHelpers::VERSION
|
8
|
-
spec.authors = ['
|
9
|
-
spec.email = ['timothy.south@crowncommercial.gov.uk']
|
8
|
+
spec.authors = ['Crown Commercial Service']
|
10
9
|
|
11
10
|
spec.summary = 'Gem containing view helpers for CCS Ruby on Rails projects'
|
12
11
|
spec.description = 'Gem containing view helpers for CCS Ruby on Rails projects'
|
13
|
-
spec.homepage = 'https://github.com/
|
12
|
+
spec.homepage = 'https://github.com/Crown-Commercial-Service/ccs-frontend_helpers'
|
14
13
|
spec.license = 'MIT'
|
15
14
|
spec.required_ruby_version = '>= 3.0.0'
|
16
15
|
|
@@ -33,7 +33,7 @@ module CCS
|
|
33
33
|
def initialize(title:, href:, description:, **options)
|
34
34
|
super(**options)
|
35
35
|
|
36
|
-
@options[:attributes][:class]
|
36
|
+
@options[:attributes][:class] << " govuk-grid-column-#{@options[:width] || 'one-third'}"
|
37
37
|
|
38
38
|
@title = title
|
39
39
|
@href = href
|
@@ -50,6 +50,10 @@ module CCS
|
|
50
50
|
concat(tag.p(description, class: 'ccs-dashboard-section__panel-description'))
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
# The default attributes for the dashboard panel
|
55
|
+
|
56
|
+
DEFAULT_ATTRIBUTES = { class: 'ccs-dashboard-section__panel' }.freeze
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
@@ -32,7 +32,7 @@ module CCS
|
|
32
32
|
# @param context [ActionView::Base] the view context
|
33
33
|
|
34
34
|
def initialize(context:, items: nil, visually_hidden_title: nil, text: nil)
|
35
|
-
@meta_links = items
|
35
|
+
@meta_links = items.map { |meta_link| Link.new(li_class: 'ccs-footer__inline-list-item', context: context, **meta_link) } if items.present?
|
36
36
|
@visually_hidden_title = visually_hidden_title || 'Support links'
|
37
37
|
@text = text
|
38
38
|
end
|
@@ -45,7 +45,7 @@ module CCS
|
|
45
45
|
capture do
|
46
46
|
concat(tag.h2(visually_hidden_title, class: 'govuk-visually-hidden'))
|
47
47
|
if meta_links
|
48
|
-
concat(tag.ul(class: 'ccs-footer__inline-list') do
|
48
|
+
concat(tag.ul(class: "ccs-footer__inline-list #{'ccs-footer__inline-list--bottom' unless text}".rstrip) do
|
49
49
|
meta_links.each { |meta_link| concat(meta_link.render) }
|
50
50
|
end)
|
51
51
|
end
|
@@ -9,8 +9,10 @@ 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/
|
12
|
+
# {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/footer CCS - Components - Footer}
|
13
13
|
#
|
14
|
+
# @!attribute [r] logo
|
15
|
+
# @return [Logo] The initialised Logo component
|
14
16
|
# @!attribute [r] navigation
|
15
17
|
# @return [Array<Navigation>] An array of the initialised navigation sections
|
16
18
|
# @!attribute [r] meta
|
@@ -19,7 +21,7 @@ module CCS
|
|
19
21
|
class Footer < Base
|
20
22
|
private
|
21
23
|
|
22
|
-
attr_reader :navigation, :meta
|
24
|
+
attr_reader :logo, :navigation, :meta
|
23
25
|
|
24
26
|
public
|
25
27
|
|
@@ -39,7 +41,8 @@ module CCS
|
|
39
41
|
|
40
42
|
@options[:copyright] ||= '© Crown copyright'
|
41
43
|
|
42
|
-
@
|
44
|
+
@logo = Logo.new(context: @context)
|
45
|
+
@navigation = navigation.map { |navigation_item| Navigation.new(context: @context, **navigation_item) } if navigation.present?
|
43
46
|
@meta = Meta.new(context: @context, **meta) if meta
|
44
47
|
end
|
45
48
|
|
@@ -60,7 +63,7 @@ module CCS
|
|
60
63
|
end
|
61
64
|
concat(tag.div(class: 'ccs-footer__meta') do
|
62
65
|
concat(tag.div(class: 'ccs-footer__meta-item') do
|
63
|
-
concat(tag.div(
|
66
|
+
concat(tag.div(logo.render, class: 'ccs-footer__logo'))
|
64
67
|
concat(footer_copyright)
|
65
68
|
end)
|
66
69
|
concat(tag.div(class: 'ccs-footer__meta-item ccs-footer__meta-item--grow') do
|
@@ -56,8 +56,9 @@ module CCS
|
|
56
56
|
@primary_links = navigation[:primary_items]&.map { |navigation_link| Link.new(li_class: LI_CLASS, context: context, **navigation_link) }
|
57
57
|
@secondary_links = navigation[:secondary_items]&.map { |navigation_link| Link.new(li_class: LI_CLASS, context: context, **navigation_link) }
|
58
58
|
@navigation_label = navigation[:label] || menu_button[:text]
|
59
|
-
@navigation_classes =
|
59
|
+
@navigation_classes = 'ccs-header__navigation'
|
60
60
|
@navigation_classes << ' ccs-header__navigation--no-service-name' unless serivce_name_present
|
61
|
+
@navigation_classes << " #{navigation[:classes]}" if navigation[:classes]
|
61
62
|
end
|
62
63
|
|
63
64
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
@@ -9,8 +9,10 @@ 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/
|
12
|
+
# {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/header CCS - Components - Header}
|
13
13
|
#
|
14
|
+
# @!attribute [r] logo
|
15
|
+
# @return [Logo] The initialised Logo component
|
14
16
|
# @!attribute [r] service_authentication
|
15
17
|
# @return [ServiceAuthentication] The initialised service authentication section
|
16
18
|
# @!attribute [r] navigation
|
@@ -21,7 +23,7 @@ module CCS
|
|
21
23
|
class Header < Base
|
22
24
|
private
|
23
25
|
|
24
|
-
attr_reader :service_authentication, :navigation, :service
|
26
|
+
attr_reader :logo, :service_authentication, :navigation, :service
|
25
27
|
|
26
28
|
public
|
27
29
|
|
@@ -48,8 +50,9 @@ module CCS
|
|
48
50
|
@options[:container_classes] ||= 'govuk-width-container'
|
49
51
|
@options[:homepage_url] ||= 'https://www.crowncommercial.gov.uk'
|
50
52
|
|
53
|
+
@logo = Logo.new(context: @context)
|
51
54
|
@service_authentication = ServiceAuthentication.new(service_authentication_items: service_authentication_items, container_classes: @options[:container_classes], context: @context) if service_authentication_items
|
52
|
-
@navigation = Navigation.new(navigation: navigation, serivce_name_present: service, menu_button: menu_button, context: @context) if navigation
|
55
|
+
@navigation = Navigation.new(navigation: navigation, serivce_name_present: service, menu_button: menu_button, context: @context) if navigation && (navigation[:primary_items] || navigation[:secondary_items])
|
53
56
|
@service = service
|
54
57
|
end
|
55
58
|
|
@@ -88,7 +91,7 @@ module CCS
|
|
88
91
|
|
89
92
|
def header_logo
|
90
93
|
tag.div(class: 'ccs-header__logo') do
|
91
|
-
link_to(
|
94
|
+
link_to(logo.render, options[:homepage_url], class: 'ccs-header__link ccs-header__link--homepage', aria: { label: 'Crown Commercial Service' })
|
92
95
|
end
|
93
96
|
end
|
94
97
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative '../base'
|
2
2
|
|
3
3
|
module CCS
|
4
4
|
module Components
|
@@ -6,18 +6,15 @@ 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/
|
10
|
-
|
11
|
-
class Logo
|
12
|
-
extend ActionView::Context
|
13
|
-
extend ActionView::Helpers
|
9
|
+
# {https://github.com/tim-s-ccs/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/logo CCS - Components - Logo}
|
14
10
|
|
11
|
+
class Logo < Base
|
15
12
|
# Generates the HTML for the CCS Logo.
|
16
13
|
# Used in {CCS::Components::CCS::Header Header} and {CCS::Components::CCS::Footer Footer}
|
17
14
|
#
|
18
15
|
# @return [ActiveSupport::SafeBuffer]
|
19
16
|
|
20
|
-
def
|
17
|
+
def render
|
21
18
|
tag.span(class: 'ccs-logo') do
|
22
19
|
concat(tag.svg(class: 'ccs-logo__svg', xmlns: 'http://www.w3.org/2000/svg', height: '101', width: '121', aria: { hidden: 'true' }, focusable: 'false', viewBox: '0 0 121 101') do
|
23
20
|
CCS_LOGO_PATHS.each { |ccs_logo_path_attributes| concat(tag.path(**ccs_logo_path_attributes)) }
|
@@ -15,16 +15,12 @@ module CCS
|
|
15
15
|
#
|
16
16
|
# @option (see CCS::Components::GovUK::Field::Input#initialize)
|
17
17
|
|
18
|
-
def initialize(attribute:, **options)
|
19
|
-
super(attribute: attribute, **options)
|
20
|
-
end
|
21
|
-
|
22
18
|
# Generates the HTML for the GOV.UK File Upload component
|
23
19
|
#
|
24
20
|
# @return [ActiveSupport::SafeBuffer]
|
25
21
|
|
26
22
|
def render
|
27
|
-
super
|
23
|
+
super do
|
28
24
|
if options[:form]
|
29
25
|
options[:form].file_field(attribute, **options[:attributes])
|
30
26
|
else
|
@@ -17,7 +17,7 @@ module CCS
|
|
17
17
|
# @option (see CCS::Components::GovUK::Field::Items::Item::Checkbox#initialize)
|
18
18
|
|
19
19
|
def initialize(attribute:, label:, **options)
|
20
|
-
super
|
20
|
+
super
|
21
21
|
|
22
22
|
(label[:attributes] ||= {})[:value] = @value
|
23
23
|
label[:attributes][:for] = @options[:attributes][:id] if @options[:attributes][:id]
|
@@ -33,7 +33,7 @@ module CCS
|
|
33
33
|
# @return [ActiveSupport::SafeBuffer]
|
34
34
|
|
35
35
|
def render
|
36
|
-
super
|
36
|
+
super do
|
37
37
|
@options[:form].check_box(@attribute, @options[:attributes], @value)
|
38
38
|
end
|
39
39
|
end
|
@@ -17,7 +17,7 @@ module CCS
|
|
17
17
|
# @option (see CCS::Components::GovUK::Field::Items::Item::Checkbox#initialize)
|
18
18
|
|
19
19
|
def initialize(attribute:, label:, **options)
|
20
|
-
super
|
20
|
+
super
|
21
21
|
|
22
22
|
@options[:attributes][:id] ||= "#{sanitize_to_id(@attribute)}_#{sanitize_to_id(@value)}"
|
23
23
|
|
@@ -29,7 +29,7 @@ module CCS
|
|
29
29
|
# @return [ActiveSupport::SafeBuffer]
|
30
30
|
|
31
31
|
def render
|
32
|
-
super
|
32
|
+
super do
|
33
33
|
context.check_box_tag("#{@attribute}[]", @value, @options[:checked], **@options[:attributes])
|
34
34
|
end
|
35
35
|
end
|
@@ -17,7 +17,7 @@ module CCS
|
|
17
17
|
# @option (see CCS::Components::GovUK::Field::Items::Item::Radio#initialize)
|
18
18
|
|
19
19
|
def initialize(attribute:, label:, **options)
|
20
|
-
super
|
20
|
+
super
|
21
21
|
|
22
22
|
(label[:attributes] ||= {})[:value] = @value
|
23
23
|
label[:attributes][:for] = @options[:attributes][:id] if @options[:attributes][:id]
|
@@ -30,7 +30,7 @@ module CCS
|
|
30
30
|
# @return [ActiveSupport::SafeBuffer]
|
31
31
|
|
32
32
|
def render
|
33
|
-
super
|
33
|
+
super do
|
34
34
|
@options[:form].radio_button(@attribute, @value, **@options[:attributes])
|
35
35
|
end
|
36
36
|
end
|
@@ -17,7 +17,7 @@ module CCS
|
|
17
17
|
# @option (see CCS::Components::GovUK::Field::Items::Item::Radio#initialize)
|
18
18
|
|
19
19
|
def initialize(attribute:, label:, **options)
|
20
|
-
super
|
20
|
+
super
|
21
21
|
|
22
22
|
@options[:attributes][:id] ||= "#{sanitize_to_id(@attribute)}_#{sanitize_to_id(@value)}"
|
23
23
|
|
@@ -29,7 +29,7 @@ module CCS
|
|
29
29
|
# @return [ActiveSupport::SafeBuffer]
|
30
30
|
|
31
31
|
def render
|
32
|
-
super
|
32
|
+
super do
|
33
33
|
context.radio_button_tag(@attribute, @value, @options[:checked], **@options[:attributes])
|
34
34
|
end
|
35
35
|
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/
|
11
|
+
# {https://github.com/tim-s-ccs/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/
|
11
|
+
# {https://github.com/tim-s-ccs/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
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../components/ccs/logo'
|
4
|
+
|
5
|
+
module CCS
|
6
|
+
module FrontendHelpers
|
7
|
+
module CCSFrontend
|
8
|
+
# = CCS Logo
|
9
|
+
#
|
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}
|
12
|
+
|
13
|
+
module Logo
|
14
|
+
# Generates the HTML for the CCS Logo component
|
15
|
+
#
|
16
|
+
# @return (see CCS::Components::CCS::Logo#render)
|
17
|
+
|
18
|
+
def ccs_logo
|
19
|
+
Components::CCS::Logo.new(context: self).render
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative 'ccs_frontend/dashboard_section'
|
4
4
|
require_relative 'ccs_frontend/footer'
|
5
5
|
require_relative 'ccs_frontend/header'
|
6
|
+
require_relative 'ccs_frontend/logo'
|
6
7
|
|
7
8
|
module CCS
|
8
9
|
module FrontendHelpers
|
@@ -13,6 +14,7 @@ module CCS
|
|
13
14
|
include DashboardSection
|
14
15
|
include Footer
|
15
16
|
include Header
|
17
|
+
include Logo
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/package.json
CHANGED
data/yarn.lock
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
# yarn lockfile v1
|
3
3
|
|
4
4
|
|
5
|
+
ccs-frontend@^1.0.0-beta.5:
|
6
|
+
version "1.0.0-beta.5"
|
7
|
+
resolved "https://registry.yarnpkg.com/ccs-frontend/-/ccs-frontend-1.0.0-beta.5.tgz#d69ae71603074922d93f0c4eea31739abe2dd0da"
|
8
|
+
integrity sha512-thdhIusFYAOHCyQT2nPTi0cqz1nGTN6ZffFryy8zF21kklVkYyvKsnx+uxrjjhJKmAMgtqxzoXxONws3OeZ8YA==
|
9
|
+
|
5
10
|
govuk-frontend@^5.4.0:
|
6
11
|
version "5.4.0"
|
7
12
|
resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-5.4.0.tgz#8f2e0b55ef7c7552a1efe68c7b40ff1b4a393e72"
|
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: 0.
|
4
|
+
version: 0.5.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Crown Commercial Service
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -25,8 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
27
|
description: Gem containing view helpers for CCS Ruby on Rails projects
|
28
|
-
email:
|
29
|
-
- timothy.south@crowncommercial.gov.uk
|
28
|
+
email:
|
30
29
|
executables: []
|
31
30
|
extensions: []
|
32
31
|
extra_rdoc_files: []
|
@@ -152,6 +151,7 @@ files:
|
|
152
151
|
- lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb
|
153
152
|
- lib/ccs/frontend_helpers/ccs_frontend/footer.rb
|
154
153
|
- lib/ccs/frontend_helpers/ccs_frontend/header.rb
|
154
|
+
- lib/ccs/frontend_helpers/ccs_frontend/logo.rb
|
155
155
|
- lib/ccs/frontend_helpers/govuk_frontend.rb
|
156
156
|
- lib/ccs/frontend_helpers/govuk_frontend/accordion.rb
|
157
157
|
- lib/ccs/frontend_helpers/govuk_frontend/back_link.rb
|
@@ -194,15 +194,15 @@ files:
|
|
194
194
|
- package.json
|
195
195
|
- sig/ccs/frontend_helpers.rbs
|
196
196
|
- yarn.lock
|
197
|
-
homepage: https://github.com/
|
197
|
+
homepage: https://github.com/Crown-Commercial-Service/ccs-frontend_helpers
|
198
198
|
licenses:
|
199
199
|
- MIT
|
200
200
|
metadata:
|
201
|
-
homepage_uri: https://github.com/
|
202
|
-
source_code_uri: https://github.com/
|
203
|
-
changelog_uri: https://github.com/
|
201
|
+
homepage_uri: https://github.com/Crown-Commercial-Service/ccs-frontend_helpers
|
202
|
+
source_code_uri: https://github.com/Crown-Commercial-Service/ccs-frontend_helpers
|
203
|
+
changelog_uri: https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/blob/main/CHANGELOG.md
|
204
204
|
rubygems_mfa_required: 'true'
|
205
|
-
post_install_message:
|
205
|
+
post_install_message:
|
206
206
|
rdoc_options: []
|
207
207
|
require_paths:
|
208
208
|
- lib
|
@@ -213,12 +213,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
213
|
version: 3.0.0
|
214
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
215
|
requirements:
|
216
|
-
- - "
|
216
|
+
- - ">"
|
217
217
|
- !ruby/object:Gem::Version
|
218
|
-
version:
|
218
|
+
version: 1.3.1
|
219
219
|
requirements: []
|
220
220
|
rubygems_version: 3.4.10
|
221
|
-
signing_key:
|
221
|
+
signing_key:
|
222
222
|
specification_version: 4
|
223
223
|
summary: Gem containing view helpers for CCS Ruby on Rails projects
|
224
224
|
test_files: []
|