ccs-frontend_helpers 0.1.0.rc.1
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 +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +127 -0
- data/CHANGELOG.md +44 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +241 -0
- data/LICENSE.txt +21 -0
- data/README.md +102 -0
- data/Rakefile +10 -0
- data/ccs-frontend_helpers.gemspec +47 -0
- data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_panels.rb +79 -0
- data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +141 -0
- data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +205 -0
- data/lib/ccs/frontend_helpers/ccs_frontend/logo.rb +49 -0
- data/lib/ccs/frontend_helpers/ccs_frontend.rb +20 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +115 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +39 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +76 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +127 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +136 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +46 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +67 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +100 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/character_count.rb +165 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/checkboxes.rb +200 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/date_input.rb +153 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/file_upload.rb +83 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/input.rb +153 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/radios.rb +201 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/select.rb +124 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field/textarea.rb +106 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/field.rb +213 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +71 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +183 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +50 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +161 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +38 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +44 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +92 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +136 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +336 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +51 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +49 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +40 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +215 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +226 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +124 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +95 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +42 -0
- data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +53 -0
- data/lib/ccs/frontend_helpers/govuk_frontend.rb +82 -0
- data/lib/ccs/frontend_helpers/shared_methods.rb +27 -0
- data/lib/ccs/frontend_helpers/version.rb +7 -0
- data/lib/ccs/frontend_helpers.rb +20 -0
- data/sig/ccs/frontend_helpers.rbs +6 -0
- metadata +241 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'logo'
|
4
|
+
require_relative '../shared_methods'
|
5
|
+
|
6
|
+
module CCS
|
7
|
+
module FrontendHelpers
|
8
|
+
module CCSFrontend
|
9
|
+
# = CCS Footer
|
10
|
+
#
|
11
|
+
# This helper is used for generating the footer component from the
|
12
|
+
# {https://github.com/tim-s-ccs/ts-ccs-frontend/tree/main/src/ccs/components/footer CCS - Components - Footer}
|
13
|
+
|
14
|
+
module Footer
|
15
|
+
include SharedMethods
|
16
|
+
include Logo
|
17
|
+
include ActionView::Helpers::FormTagHelper
|
18
|
+
include ActionView::Helpers::UrlHelper
|
19
|
+
|
20
|
+
# rubocop:disable Metrics/AbcSize
|
21
|
+
|
22
|
+
# Generates the HTML for the CCS Footer component
|
23
|
+
#
|
24
|
+
# @param ccs_footer_options [Hash] options that will be used in customising the HTML
|
25
|
+
#
|
26
|
+
# @option ccs_footer_options [String] :classes additional CSS classes for the footer HTML
|
27
|
+
# @option ccs_footer_options [String] :container_class classes that can be added to the inner container
|
28
|
+
# @option ccs_footer_options [Array] :navigation (see: {ccs_footer_navigation})
|
29
|
+
# @option ccs_footer_options [Hash] :meta (see: {ccs_footer_meta})
|
30
|
+
# @option ccs_footer_options [ActiveSupport::SafeBuffer,String] :copyright The copyright information. See {ccs_footer_copyright}
|
31
|
+
# @option ccs_footer_options [Hash] :attributes additional attributes that will added as part of the HTML
|
32
|
+
#
|
33
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the CCS Footer
|
34
|
+
# which can then be rendered on the page
|
35
|
+
|
36
|
+
def ccs_footer(**ccs_footer_options)
|
37
|
+
initialise_attributes_and_set_classes(ccs_footer_options, 'ccs-footer')
|
38
|
+
|
39
|
+
ccs_footer_options[:attributes][:role] = 'contentinfo'
|
40
|
+
|
41
|
+
tag.footer(**ccs_footer_options[:attributes]) do
|
42
|
+
tag.div(class: "govuk-width-container #{ccs_footer_options[:container_classes]}".rstrip) do
|
43
|
+
if ccs_footer_options[:navigation]
|
44
|
+
concat(tag.div(class: 'ccs-footer__navigation') do
|
45
|
+
ccs_footer_options[:navigation].each { |navigation_item| concat(ccs_footer_navigation(navigation_item)) }
|
46
|
+
end)
|
47
|
+
concat(tag.hr(class: 'ccs-footer__section-break'))
|
48
|
+
end
|
49
|
+
concat(tag.div(class: 'ccs-footer__meta') do
|
50
|
+
concat(tag.div(class: 'ccs-footer__meta-item') do
|
51
|
+
concat(tag.div(ccs_logo, class: 'ccs-footer__logo'))
|
52
|
+
concat(ccs_footer_copyright(ccs_footer_options[:copyright]))
|
53
|
+
end)
|
54
|
+
concat(tag.div(class: 'ccs-footer__meta-item ccs-footer__meta-item--grow') do
|
55
|
+
concat(ccs_footer_meta(ccs_footer_options[:meta])) if ccs_footer_options[:meta]
|
56
|
+
end)
|
57
|
+
end)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Generates the HTML for the navigation section in {ccs_footer}
|
65
|
+
#
|
66
|
+
# @param navigation_item [Hash] options that will be used for the navigation section
|
67
|
+
#
|
68
|
+
# @option navigation_item [String] :title title for a section
|
69
|
+
# @option navigation_item [String] :width (default: 'fall') width of each navigation section in the footer
|
70
|
+
# @option navigation_item [Integer] :columns amount of columns to display items in navigation section of the footer
|
71
|
+
# @option navigation_item [Array] :items array of items to display in the list in navigation section of the footer.
|
72
|
+
# Each item can have the following options:
|
73
|
+
# - +:text+ list item text
|
74
|
+
# - +:href+ list item href
|
75
|
+
# - +:attributes+ HTML attributes to add to the link
|
76
|
+
#
|
77
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the navigation section in {ccs_footer}
|
78
|
+
|
79
|
+
def ccs_footer_navigation(navigation_item)
|
80
|
+
tag.div(class: "ccs-footer__section govuk-grid-column-#{navigation_item[:width] || 'full'}") do
|
81
|
+
concat(tag.h2(navigation_item[:title], class: 'ccs-footer__heading govuk-heading-m'))
|
82
|
+
concat(tag.ul(class: "ccs-footer__list #{"ccs-footer__list--columns-#{navigation_item[:columns]}" if navigation_item[:columns]}".rstrip) do
|
83
|
+
navigation_item[:items].each do |item|
|
84
|
+
concat(tag.li(class: 'ccs-footer__list-item') do
|
85
|
+
(item[:attributes] ||= {})[:class] = 'ccs-footer__link'
|
86
|
+
|
87
|
+
link_to(item[:text], item[:href], **item[:attributes])
|
88
|
+
end)
|
89
|
+
end
|
90
|
+
end)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Generates the HTML for the meta section in {ccs_footer}
|
95
|
+
#
|
96
|
+
# @param meta [Hash] options that will be used for the meta section
|
97
|
+
#
|
98
|
+
# @option meta [String] :visually_hidden_title (default: 'Support links') title for a meta item section
|
99
|
+
# @option meta [ActiveSupport::SafeBuffer,String] :text text to add to the meta section of the footer,
|
100
|
+
# which will appear below any links specified using meta.items
|
101
|
+
# @option meta [Array] :items array of items to display in the list in meta section of the footer.
|
102
|
+
# Each item can have the following options:
|
103
|
+
# - +:text+ list item text
|
104
|
+
# - +:href+ list item href
|
105
|
+
# - +:attributes+ HTML attributes to add to the link
|
106
|
+
#
|
107
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the meta section in {ccs_footer}
|
108
|
+
|
109
|
+
def ccs_footer_meta(meta)
|
110
|
+
concat(tag.h2(meta[:visually_hidden_title] || 'Support links', class: 'govuk-visually-hidden'))
|
111
|
+
if meta[:items]
|
112
|
+
concat(tag.ul(class: 'ccs-footer__inline-list') do
|
113
|
+
meta[:items].each do |meta_item|
|
114
|
+
concat(tag.li(class: 'ccs-footer__inline-list-item') do
|
115
|
+
(meta_item[:attributes] ||= {})[:class] = 'ccs-footer__link'
|
116
|
+
|
117
|
+
link_to(meta_item[:text], meta_item[:href], **meta_item[:attributes])
|
118
|
+
end)
|
119
|
+
end
|
120
|
+
end)
|
121
|
+
end
|
122
|
+
concat(tag.div(meta[:text], class: 'ccs-footer__meta-custom')) if meta[:text]
|
123
|
+
end
|
124
|
+
|
125
|
+
# rubocop:enable Metrics/AbcSize
|
126
|
+
|
127
|
+
# Generates the copyright used in {ccs_footer}
|
128
|
+
#
|
129
|
+
# @param copyright [ActiveSupport::SafeBuffer,String] the copyright information, this defaults to Crown Copyright
|
130
|
+
#
|
131
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the copyright used in {ccs_footer}
|
132
|
+
|
133
|
+
def ccs_footer_copyright(copyright)
|
134
|
+
tag.div(class: 'ccs-footer__copyright') do
|
135
|
+
link_to(copyright || '© Crown copyright', 'https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/', class: 'ccs-footer__link')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'logo'
|
4
|
+
require_relative '../shared_methods'
|
5
|
+
|
6
|
+
module CCS
|
7
|
+
module FrontendHelpers
|
8
|
+
module CCSFrontend
|
9
|
+
# = CCS Header
|
10
|
+
#
|
11
|
+
# This helper is used for generating the header component from the
|
12
|
+
# {https://github.com/tim-s-ccs/ts-ccs-frontend/tree/main/src/ccs/components/header CCS - Components - Header}
|
13
|
+
|
14
|
+
module Header
|
15
|
+
include SharedMethods
|
16
|
+
include Logo
|
17
|
+
include ActionView::Helpers::FormTagHelper
|
18
|
+
include ActionView::Helpers::UrlHelper
|
19
|
+
|
20
|
+
# rubocop:disable Metrics/AbcSize
|
21
|
+
|
22
|
+
# Generates the HTML for the CCS Header component
|
23
|
+
#
|
24
|
+
# @param ccs_header_options [Hash] options that will be used to generate the header
|
25
|
+
#
|
26
|
+
# @option ccs_header_options [String] :classes additional CSS classes for the header HTML
|
27
|
+
# @option ccs_header_options [Hash] :attributes additional attributes that will added as part of the header HTML
|
28
|
+
# @option ccs_header_options [String] :container_classes classes for the container
|
29
|
+
# @option ccs_header_options [String] :homepage_url URL of the homepage. Defaults to +https://www.crowncommercial.gov.uk+
|
30
|
+
# @option ccs_header_options [Array] :service_authentication see {ccs_service_authentication}
|
31
|
+
# @option ccs_header_options [Hash] :service see {ccs_header_service_name}
|
32
|
+
# @option ccs_header_options [Hash] :navigation see {ccs_header_navigation}
|
33
|
+
# @option ccs_header_options [Hash] :menu_button see {ccs_header_navigation}
|
34
|
+
#
|
35
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the CCS Header
|
36
|
+
# which can then be rendered on the page
|
37
|
+
|
38
|
+
def ccs_header(**ccs_header_options)
|
39
|
+
determine_ccs_header_attributes(ccs_header_options)
|
40
|
+
|
41
|
+
tag.header(**ccs_header_options[:attributes]) do
|
42
|
+
concat(ccs_service_authentication(ccs_header_options[:service_authentication], ccs_header_options[:container_classes])) if ccs_header_options[:service_authentication]
|
43
|
+
concat(tag.div(class: "ccs-header__container #{ccs_header_options[:container_classes]}") do
|
44
|
+
concat(ccs_header_logo(**ccs_header_options))
|
45
|
+
if ccs_header_options[:service] || ccs_header_options[:navigation]
|
46
|
+
concat(tag.div(class: 'ccs-header__content') do
|
47
|
+
concat(ccs_header_service_name(ccs_header_options[:service])) if ccs_header_options[:service]
|
48
|
+
concat(ccs_header_navigation(ccs_header_options[:navigation], ccs_header_options[:menu_button], ccs_header_options[:service])) if ccs_header_options[:navigation]
|
49
|
+
end)
|
50
|
+
end
|
51
|
+
end)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# rubocop:enable Metrics/AbcSize
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
# Generates the service authentication section for {ccs_header}
|
60
|
+
#
|
61
|
+
# @param service_authentication [Array] array of service authentication items (see {ccs_header_navigation_item})
|
62
|
+
# @param container_classes [String] classes for the container
|
63
|
+
#
|
64
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the service authentication section which is used in {ccs_header}
|
65
|
+
|
66
|
+
def ccs_service_authentication(service_authentication, container_classes)
|
67
|
+
tag.div(class: 'ccs-header__service-authentication') do
|
68
|
+
tag.div(class: "ccs-header__service-authentication-container #{container_classes}") do
|
69
|
+
tag.ul(class: 'ccs-header__service-authentication-list') do
|
70
|
+
service_authentication.each do |service_authentication_item|
|
71
|
+
concat(tag.li(class: 'ccs-header__service-authentication-item') do
|
72
|
+
if service_authentication_item[:href]
|
73
|
+
(service_authentication_item[:attributes] ||= {})[:class] = 'ccs-header__link'
|
74
|
+
|
75
|
+
link_to(service_authentication_item[:text], service_authentication_item[:href], **service_authentication_item[:attributes])
|
76
|
+
else
|
77
|
+
service_authentication_item[:text]
|
78
|
+
end
|
79
|
+
end)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Generates the logo for {ccs_header}
|
87
|
+
#
|
88
|
+
# @param (see ccs_header)
|
89
|
+
#
|
90
|
+
# @option (see ccs_header)
|
91
|
+
#
|
92
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the logo used in {ccs_header}
|
93
|
+
|
94
|
+
def ccs_header_logo(ccs_header_options)
|
95
|
+
tag.div(class: 'ccs-header__logo') do
|
96
|
+
link_to(ccs_logo, ccs_header_options[:homepage_url] || 'https://www.crowncommercial.gov.uk', class: 'ccs-header__link ccs-header__link--homepage', aria: { label: 'Crown Commercial Service' })
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Generates the service name section for {ccs_header}
|
101
|
+
#
|
102
|
+
# @param service [Hash] options that will be used in the service name section
|
103
|
+
#
|
104
|
+
# @option service [String] :name the name of the service, included in the header
|
105
|
+
# @option service [String] :href URL for the service name anchor
|
106
|
+
#
|
107
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the service name section which is used in {ccs_header}
|
108
|
+
|
109
|
+
def ccs_header_service_name(service)
|
110
|
+
if service[:href]
|
111
|
+
link_to(service[:name], service[:href], class: 'ccs-header__link ccs-header__link--service-name')
|
112
|
+
else
|
113
|
+
tag.span(service[:name], class: 'ccs-header__link--service-name')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
118
|
+
|
119
|
+
# @option ccs_header_options [String] :navigation_label text for the aria-label attribute of the navigation.
|
120
|
+
# Defaults to the same value as +:text+ in +:menu_button+
|
121
|
+
# @option ccs_header_options [String] :navigation_classes classes for the navigation section of the header
|
122
|
+
|
123
|
+
# Generates the navigation section for {ccs_header}
|
124
|
+
#
|
125
|
+
# @param navigation [Hash] options for the navigation
|
126
|
+
# @param menu_button [Hash] options for the menu button
|
127
|
+
# @param serivce_name_present [Boolean] flag to indicate if the service name section is present
|
128
|
+
#
|
129
|
+
# @option navigation [String] :label text for the aria-label attribute of the navigation.
|
130
|
+
# Defaults to the same value as +:text+ in +:menu_button+
|
131
|
+
# @option navigation [String] :classes classes for the navigation section of the header
|
132
|
+
# @option navigation [Array] :primary_items primary navigation items that will be rendered on the page (see {ccs_header_navigation_item})
|
133
|
+
# @option navigation [Array] :secondary_items secondary navigation items that will be rendered on the page (see {ccs_header_navigation_item})
|
134
|
+
#
|
135
|
+
# @option menu_button [String] :text text for the button that opens the mobile navigation menu.
|
136
|
+
# By default, this is set to +Menu+.
|
137
|
+
# @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
|
138
|
+
# Defaults to +Show or hide menu+.
|
139
|
+
#
|
140
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the navigation section which is used in {ccs_header}
|
141
|
+
|
142
|
+
def ccs_header_navigation(navigation, menu_button, serivce_name_present)
|
143
|
+
(menu_button ||= {})[:text] ||= 'Menu'
|
144
|
+
navigation_classes = "ccs-header__navigation #{navigation[:classes]}".rstrip
|
145
|
+
navigation_classes << ' ccs-header__navigation--no-service-name' unless serivce_name_present
|
146
|
+
|
147
|
+
tag.nav(aria: { label: navigation[:label] || menu_button[:text] }, class: navigation_classes) do
|
148
|
+
concat(button_tag(menu_button[:text], type: :button, class: 'ccs-header__menu-button ccs-js-header-toggle', aria: { controls: 'navigation', label: menu_button[:label] || 'Show or hide menu' }, hidden: true))
|
149
|
+
concat(tag.div(id: 'navigation', class: 'ccs-header__navigation-lists') do
|
150
|
+
if navigation[:secondary_items]
|
151
|
+
concat(tag.ul(id: 'navigation-secondary', class: "ccs-header__navigation-secondary-list #{'ccs-header__navigation--no-second-list' unless navigation[:primary_items]}") do
|
152
|
+
navigation[:secondary_items].each { |navigation_item| concat(ccs_header_navigation_item(navigation_item)) }
|
153
|
+
end)
|
154
|
+
end
|
155
|
+
if navigation[:primary_items]
|
156
|
+
concat(tag.ul(id: 'navigation-primary', class: "ccs-header__navigation-primary-list #{'ccs-header__navigation--no-second-list' unless navigation[:secondary_items]}") do
|
157
|
+
navigation[:primary_items].each { |navigation_item| concat(ccs_header_navigation_item(navigation_item)) }
|
158
|
+
end)
|
159
|
+
end
|
160
|
+
end)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
165
|
+
|
166
|
+
# Generates a navigation item for {ccs_header_navigation_item}
|
167
|
+
#
|
168
|
+
# @param navigation_item [Hash] options that will be used in customising the HTML
|
169
|
+
#
|
170
|
+
# @option navigation_item [Boolean] :active flag to mark the navigation item as active or not
|
171
|
+
# @option navigation_item [String] :text text for the navigation item
|
172
|
+
# @option navigation_item [String] :href URL of the navigation item anchor
|
173
|
+
# @option navigation_item [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
174
|
+
#
|
175
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for a navigation item which is used in {ccs_header_navigation_item}
|
176
|
+
|
177
|
+
def ccs_header_navigation_item(navigation_item)
|
178
|
+
tag.li(class: "ccs-header__navigation-item #{'ccs-header__navigation-item--active' if navigation_item[:active]}".rstrip) do
|
179
|
+
if navigation_item[:href]
|
180
|
+
(navigation_item[:attributes] ||= {})[:class] = 'ccs-header__link'
|
181
|
+
|
182
|
+
link_to(navigation_item[:text], navigation_item[:href], **navigation_item[:attributes])
|
183
|
+
else
|
184
|
+
navigation_item[:text]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# Sets the default attributes for {ccs_header}
|
190
|
+
#
|
191
|
+
# @param ccs_header_options [Hash] options that will be used in customising the HTML
|
192
|
+
#
|
193
|
+
# @option (see ccs_header)
|
194
|
+
|
195
|
+
def determine_ccs_header_attributes(ccs_header_options)
|
196
|
+
initialise_attributes_and_set_classes(ccs_header_options, 'ccs-header')
|
197
|
+
set_data_module(ccs_header_options, 'ccs-header')
|
198
|
+
|
199
|
+
ccs_header_options[:attributes][:role] = 'banner'
|
200
|
+
ccs_header_options[:container_classes] ||= 'govuk-width-container'
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'action_view'
|
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/ts-ccs-frontend/tree/main/src/ccs/components/logo CCS - Components - Logo}
|
12
|
+
|
13
|
+
module Logo
|
14
|
+
include ActionView::Context
|
15
|
+
include ActionView::Helpers::TagHelper
|
16
|
+
include ActionView::Helpers::TextHelper
|
17
|
+
|
18
|
+
# Generates the CCS logo used in {ccs_header} and {ccs_footer}
|
19
|
+
#
|
20
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the logo used in {ccs_header} and {ccs_footer}
|
21
|
+
|
22
|
+
def ccs_logo
|
23
|
+
tag.span(class: 'ccs-logo') do
|
24
|
+
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
|
25
|
+
CCS_LOGO_PATHS.each { |ccs_logo_path_attributes| concat(tag.path(**ccs_logo_path_attributes)) }
|
26
|
+
end)
|
27
|
+
concat(tag.span('Crown Commercial Service', class: 'ccs-logo__text', hidden: true))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Array of the SVG paths for the CCS Logo
|
32
|
+
|
33
|
+
CCS_LOGO_PATHS = [
|
34
|
+
{
|
35
|
+
fill: 'currentColor',
|
36
|
+
'fill-rule': 'evenodd',
|
37
|
+
d: 'M1.9.4H0v99.8h1.9V.4zm20 43c-.4-2.2-2.1-3.3-4.3-3.3-3.7 0-5.3 3-5.3 6.3 0 3.6 1.6 6.6 5.3 6.6 2.7 0 4.3-2 4.5-4.5h2c-.3 3.9-2.8 6.2-6.7 6.2-4.8 0-7.2-3.5-7.2-8 0-4.6 2.6-8.3 7.4-8.3 3.3 0 6 1.8 6.4 5h-2zm4-.3h1.7v2.3c1-1.8 2.2-2.7 4.2-2.6v2c-3 0-4.1 1.7-4.1 4.5v5h-1.8zm11.6-.3c3.6 0 5.5 2.6 5.5 5.9s-2 5.9-5.5 5.9c-3.6 0-5.5-2.6-5.5-6 0-3.2 2-5.8 5.5-5.8zm0 10.1c2 0 3.5-1.5 3.5-4.3s-1.6-4.2-3.5-4.2c-2 0-3.5 1.5-3.5 4.2 0 2.8 1.6 4.3 3.5 4.3zm18 1.4h-2l-2.4-9-2.3 9h-2l-3.6-11.2h2l2.6 9.2 2.3-9.2h2l2.4 9.2L57 43h2zm4.8-11.2H62v1.8a4 4 0 0 1 3.7-2.1c3 0 4 1.7 4 4.1v7.4h-2v-7.6c0-1.4-.8-2.2-2.2-2.2-2.3 0-3.4 1.5-3.4 3.5v6.4h-1.8V43zM22 66.4c-.5-2.2-2.2-3.3-4.4-3.3-3.7 0-5.3 3-5.3 6.3 0 3.5 1.6 6.5 5.3 6.5 2.7 0 4.3-2 4.5-4.5h2c-.3 3.9-2.7 6.2-6.7 6.2-4.8 0-7.2-3.5-7.2-8 0-4.6 2.6-8.3 7.4-8.3 3.3 0 6 1.8 6.4 5.1h-2zm8.8-.7c3.6 0 5.5 2.6 5.5 6s-1.9 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.4a37 37 0 0 1 0-1.5l-.1-.7-.5.2c-.2 0-.7-.5-.7-1 0-.6.5-1.3.5-2 0-.2.2-.4.3-.2l.5 1c-.2.9.9 1.8 1.7 1-.4.1-.7-.2-.9-.6h.4c.3.4 1.2.4 1.4-.6-.1.2-.4.4-.7.3.3-.2.5-.7.5-1.1 0-2.4-2.8-2.7-2.8-4.8 0-.8.7-1.3 1.1-1.3l.5.1c-.2.2-.3.5-.3.8.1 1.7 2.8 1.7 2.9 2.5.3-1.4-1.7-1-1.8-2.7z' }
|
45
|
+
].freeze
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'ccs_frontend/footer'
|
4
|
+
require_relative 'ccs_frontend/header'
|
5
|
+
require_relative 'ccs_frontend/logo'
|
6
|
+
require_relative 'ccs_frontend/dashboard_panels'
|
7
|
+
|
8
|
+
module CCS
|
9
|
+
module FrontendHelpers
|
10
|
+
# This module loads in all the CCS Frontend Helper methods.
|
11
|
+
# These are a collection of view helpers to help render CCS components
|
12
|
+
|
13
|
+
module CCSFrontend
|
14
|
+
include DashboardPanels
|
15
|
+
include Footer
|
16
|
+
include Header
|
17
|
+
include Logo
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'action_view'
|
4
|
+
|
5
|
+
require_relative '../shared_methods'
|
6
|
+
|
7
|
+
module CCS
|
8
|
+
module FrontendHelpers
|
9
|
+
module GovUKFrontend
|
10
|
+
# = GOV.UK Accordion
|
11
|
+
#
|
12
|
+
# This helper is used for generating the accordion component from the
|
13
|
+
# {https://design-system.service.gov.uk/accordion/back-link GDS - Components - Accordion}
|
14
|
+
|
15
|
+
module Accordion
|
16
|
+
include SharedMethods
|
17
|
+
include ActionView::Context
|
18
|
+
include ActionView::Helpers::TagHelper
|
19
|
+
include ActionView::Helpers::TextHelper
|
20
|
+
|
21
|
+
# Generates the HTML for the GOV.UK accordion component
|
22
|
+
#
|
23
|
+
# @param accordion_id [String] used as an id in the HTML for the accordion as a whole,
|
24
|
+
# and also as a prefix for the ids of the section contents
|
25
|
+
# and the buttons that open them
|
26
|
+
# @param accordion_items [Array<Hash>] an array of accordion items.
|
27
|
+
# See {#govuk_accordion_section} for details of the items in the array.
|
28
|
+
# @param govuk_accordion_options [Hash] options that will be used in customising the HTML
|
29
|
+
#
|
30
|
+
# @option govuk_accordion_options [String] :classes additional CSS classes for the accordion HTML
|
31
|
+
# @option govuk_accordion_options [Integer] :heading_level (2) heading level, from 1 to 6
|
32
|
+
# @option govuk_accordion_options [Hash] :attributes ({ data: { module: 'govuk-accordion' } }) any additional
|
33
|
+
# attributes that will added as part of the HTML
|
34
|
+
#
|
35
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the GOV.UK Accordion
|
36
|
+
# which can then be rendered on the page
|
37
|
+
|
38
|
+
def govuk_accordion(accordion_id, accordion_items, **govuk_accordion_options)
|
39
|
+
initialise_attributes_and_set_classes(govuk_accordion_options, 'govuk-accordion')
|
40
|
+
set_data_module(govuk_accordion_options, 'govuk-accordion')
|
41
|
+
|
42
|
+
govuk_accordion_options[:attributes][:id] = accordion_id
|
43
|
+
govuk_accordion_options[:heading_level] ||= 2
|
44
|
+
|
45
|
+
tag.div(**govuk_accordion_options[:attributes]) do
|
46
|
+
accordion_items.each.with_index(1) { |accordion_item, index| concat(govuk_accordion_section(accordion_id, accordion_item, index, govuk_accordion_options[:heading_level])) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# Generates the HTML for an accordion section, used by {govuk_accordion}
|
53
|
+
#
|
54
|
+
# @param accordion_id [String] used as an id in the HTML for the accordion
|
55
|
+
# @param index [Integer] the index of the accordion item
|
56
|
+
# @param heading_level [Integer] heading level, from 1 to 6
|
57
|
+
#
|
58
|
+
# @option accordion_item [Boolean] :expanded sets whether the section should be expanded
|
59
|
+
# when the page loads for the first time.
|
60
|
+
# @option accordion_item [String] :heading_level (2) Heading level, from 1 to 6
|
61
|
+
# @option accordion_item [String] :heading the heading text for the accordion
|
62
|
+
# @option accordion_item [String] :summary (nil) optional summary text for the accordion header
|
63
|
+
# @option accordion_item [String, ActiveSupport::SafeBuffer] the content within the accordion section
|
64
|
+
#
|
65
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for an accordion section
|
66
|
+
# which is used in {govuk_accordion}
|
67
|
+
|
68
|
+
def govuk_accordion_section(accordion_id, accordion_item, index, heading_level)
|
69
|
+
tag.div(class: "govuk-accordion__section #{'govuk-accordion__section--expanded' if accordion_item[:expanded]}".rstrip) do
|
70
|
+
concat(govuk_accordion_section_header(accordion_id, accordion_item, index, heading_level))
|
71
|
+
concat(govuk_accordion_section_content(accordion_id, accordion_item, index))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Generates the HTML for an accordion section heading, used by {govuk_accordion_section}
|
76
|
+
#
|
77
|
+
# @param (see govuk_accordion_section)
|
78
|
+
#
|
79
|
+
# @option (see govuk_accordion_section)
|
80
|
+
#
|
81
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for an accordion section heading
|
82
|
+
# which is used in {govuk_accordion_section}
|
83
|
+
|
84
|
+
def govuk_accordion_section_header(accordion_id, accordion_item, index, heading_level)
|
85
|
+
tag.div(class: 'govuk-accordion__section-header') do
|
86
|
+
concat(tag.send("h#{heading_level}", class: 'govuk-accordion__section-heading') do
|
87
|
+
tag.span(accordion_item[:heading], class: 'govuk-accordion__section-button', id: "#{accordion_id}-heading-#{index}")
|
88
|
+
end)
|
89
|
+
concat(tag.div(accordion_item[:summary], class: 'govuk-accordion__section-summary govuk-body', id: "#{accordion_id}-summary-#{index}")) if accordion_item[:summary]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Generates the HTML for an accordion sections content, used by {govuk_accordion_section}
|
94
|
+
#
|
95
|
+
# @param accordion_id [String] used as an id in the HTML for the accordion
|
96
|
+
# @param index [Integer] the index of the accordion item
|
97
|
+
#
|
98
|
+
# @option (see govuk_accordion_section)
|
99
|
+
#
|
100
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for an accordion sections content
|
101
|
+
# which is used in {govuk_accordion_section}
|
102
|
+
|
103
|
+
def govuk_accordion_section_content(accordion_id, accordion_item, index)
|
104
|
+
tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}", aria: { labelledby: "#{accordion_id}-heading-#{index}" }) do
|
105
|
+
if accordion_item[:content].is_a? ActiveSupport::SafeBuffer
|
106
|
+
accordion_item[:content]
|
107
|
+
else
|
108
|
+
tag.p(accordion_item[:content], class: 'govuk-body')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'action_view'
|
4
|
+
|
5
|
+
require_relative '../shared_methods'
|
6
|
+
|
7
|
+
module CCS
|
8
|
+
module FrontendHelpers
|
9
|
+
module GovUKFrontend
|
10
|
+
# = GOV.UK Back Link
|
11
|
+
#
|
12
|
+
# This helper is used for generating the back link component from the
|
13
|
+
# {https://design-system.service.gov.uk/components/back-link GDS - Components - Back link}
|
14
|
+
|
15
|
+
module BackLink
|
16
|
+
include SharedMethods
|
17
|
+
include ActionView::Helpers::UrlHelper
|
18
|
+
|
19
|
+
# Generates the HTML for the GOV.UK Back link component
|
20
|
+
#
|
21
|
+
# @param text [String] the text for the back link
|
22
|
+
# @param href [String] the href for the back link
|
23
|
+
# @param govuk_back_link_options [Hash] options that will be used in customising the HTML
|
24
|
+
#
|
25
|
+
# @option govuk_back_link_options [String] :classes additional CSS classes for the back link HTML
|
26
|
+
# @option govuk_back_link_options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
27
|
+
#
|
28
|
+
# @return [ActiveSupport::SafeBuffer] the HTML for the GOV.UK Back link
|
29
|
+
# which can then be rendered on the page
|
30
|
+
|
31
|
+
def govuk_back_link(text, href, **govuk_back_link_options)
|
32
|
+
initialise_attributes_and_set_classes(govuk_back_link_options, 'govuk-back-link')
|
33
|
+
|
34
|
+
link_to(text, href, **govuk_back_link_options[:attributes])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|