ccs-frontend_helpers 0.1.0.rc.2 → 0.1.0.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/lib/ccs/components/ccs/dashboard_section/panel.rb +43 -41
- data/lib/ccs/components/ccs/dashboard_section.rb +50 -48
- data/lib/ccs/components/ccs/footer/link.rb +41 -39
- data/lib/ccs/components/ccs/footer/meta.rb +49 -48
- data/lib/ccs/components/ccs/footer/navigation.rb +51 -50
- data/lib/ccs/components/ccs/footer.rb +69 -67
- data/lib/ccs/components/ccs/header/link.rb +47 -45
- data/lib/ccs/components/ccs/header/navigation.rb +85 -84
- data/lib/ccs/components/ccs/header/service_authentication.rb +35 -34
- data/lib/ccs/components/ccs/header.rb +87 -85
- data/lib/ccs/components/ccs/logo.rb +36 -34
- data/lib/ccs/components/govuk/accordion/section/content.rb +42 -42
- data/lib/ccs/components/govuk/accordion/section/header.rb +48 -48
- data/lib/ccs/components/govuk/accordion/section.rb +49 -48
- data/lib/ccs/components/govuk/accordion.rb +43 -41
- data/lib/ccs/components/govuk/back_link.rb +39 -37
- data/lib/ccs/components/govuk/breadcrumbs/link.rb +42 -40
- data/lib/ccs/components/govuk/breadcrumbs.rb +40 -38
- data/lib/ccs/components/govuk/button.rb +83 -81
- data/lib/ccs/components/govuk/cookie_banner/action.rb +45 -43
- data/lib/ccs/components/govuk/cookie_banner/message.rb +57 -55
- data/lib/ccs/components/govuk/cookie_banner.rb +40 -38
- data/lib/ccs/components/govuk/details.rb +38 -36
- data/lib/ccs/components/govuk/error_message.rb +46 -44
- data/lib/ccs/components/govuk/error_summary/item.rb +41 -39
- data/lib/ccs/components/govuk/error_summary.rb +49 -47
- data/lib/ccs/components/govuk/field/input/character_count.rb +101 -99
- data/lib/ccs/components/govuk/field/input/file_upload.rb +29 -27
- data/lib/ccs/components/govuk/field/input/select.rb +61 -59
- data/lib/ccs/components/govuk/field/input/text_input/fix.rb +39 -37
- data/lib/ccs/components/govuk/field/input/text_input.rb +75 -73
- data/lib/ccs/components/govuk/field/input/textarea.rb +43 -41
- data/lib/ccs/components/govuk/field/input.rb +46 -44
- data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +43 -41
- data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +48 -46
- data/lib/ccs/components/govuk/field/inputs/date_input.rb +68 -66
- data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +29 -27
- data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +26 -24
- data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +32 -30
- data/lib/ccs/components/govuk/field/inputs/item/divider.rb +39 -37
- data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +27 -25
- data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +26 -24
- data/lib/ccs/components/govuk/field/inputs/item/radio.rb +32 -30
- data/lib/ccs/components/govuk/field/inputs/item.rb +100 -98
- data/lib/ccs/components/govuk/field/inputs/radios.rb +43 -41
- data/lib/ccs/components/govuk/field/inputs.rb +42 -40
- data/lib/ccs/components/govuk/field.rb +90 -88
- data/lib/ccs/components/govuk/fieldset/legend.rb +50 -48
- data/lib/ccs/components/govuk/fieldset.rb +40 -38
- data/lib/ccs/components/govuk/footer/link.rb +41 -39
- data/lib/ccs/components/govuk/footer/meta.rb +49 -48
- data/lib/ccs/components/govuk/footer/navigation.rb +51 -50
- data/lib/ccs/components/govuk/footer.rb +105 -103
- data/lib/ccs/components/govuk/form_group.rb +45 -43
- data/lib/ccs/components/govuk/header/link.rb +41 -39
- data/lib/ccs/components/govuk/header/navigation.rb +54 -53
- data/lib/ccs/components/govuk/header.rb +84 -82
- data/lib/ccs/components/govuk/hint.rb +33 -31
- data/lib/ccs/components/govuk/inset_text.rb +39 -37
- data/lib/ccs/components/govuk/label.rb +61 -59
- data/lib/ccs/components/govuk/notification_banner.rb +83 -81
- data/lib/ccs/components/govuk/pagination/increment/next.rb +29 -27
- data/lib/ccs/components/govuk/pagination/increment/previous.rb +28 -26
- data/lib/ccs/components/govuk/pagination/increment.rb +78 -76
- data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +17 -15
- data/lib/ccs/components/govuk/pagination/item/form.rb +34 -32
- data/lib/ccs/components/govuk/pagination/item/tag.rb +33 -31
- data/lib/ccs/components/govuk/pagination/item.rb +47 -45
- data/lib/ccs/components/govuk/pagination.rb +69 -67
- data/lib/ccs/components/govuk/panel.rb +49 -47
- data/lib/ccs/components/govuk/phase_banner.rb +50 -48
- data/lib/ccs/components/govuk/skip_link.rb +39 -37
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +40 -38
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +30 -28
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +28 -26
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +47 -45
- data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +49 -47
- data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +44 -42
- data/lib/ccs/components/govuk/step_by_step_navigation.rb +41 -39
- data/lib/ccs/components/govuk/summary_list/action/link.rb +46 -44
- data/lib/ccs/components/govuk/summary_list/card/actions.rb +38 -36
- data/lib/ccs/components/govuk/summary_list/card/title.rb +37 -35
- data/lib/ccs/components/govuk/summary_list/card.rb +48 -46
- data/lib/ccs/components/govuk/summary_list/row/actions.rb +38 -36
- data/lib/ccs/components/govuk/summary_list/row/key.rb +30 -28
- data/lib/ccs/components/govuk/summary_list/row/value.rb +30 -28
- data/lib/ccs/components/govuk/summary_list/row.rb +47 -45
- data/lib/ccs/components/govuk/summary_list.rb +48 -46
- data/lib/ccs/components/govuk/table/body/data_cell.rb +38 -36
- data/lib/ccs/components/govuk/table/body/head_cell.rb +37 -35
- data/lib/ccs/components/govuk/table/header/head_cell.rb +39 -37
- data/lib/ccs/components/govuk/table.rb +83 -81
- data/lib/ccs/components/govuk/tabs/panel.rb +47 -45
- data/lib/ccs/components/govuk/tabs/tab.rb +42 -40
- data/lib/ccs/components/govuk/tabs.rb +48 -46
- data/lib/ccs/components/govuk/tag.rb +39 -37
- data/lib/ccs/components/govuk/warning_text.rb +49 -47
- data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +16 -14
- data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +17 -15
- data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +17 -15
- data/lib/ccs/frontend_helpers/ccs_frontend.rb +1 -1
- data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +32 -30
- data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +38 -36
- data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +27 -25
- data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +18 -16
- data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +18 -16
- data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +24 -22
- data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +19 -17
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 675c60c51c25d5cd22e26b1e92a579053d1340200bc4a33e9a4e36e65b6790ca
|
4
|
+
data.tar.gz: b90658aa1deadfa04ee5dd2d12be7f8a62b83656017a0fc557812fced67a789f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5ec2d542ec51558264bfd069546b59969ff401fc1c49c0b332ea547ce7504e477d8dd01ae50f16a7b322d1e80b3d5e584d540259c398090b5aba10af240cd33
|
7
|
+
data.tar.gz: 93ed922f0db520239e8d27bf422ebf9badaad94cd014f7af431e6009d5d1ba4b9ffb96cfca565e7e7ff1ed2d4912a2f7189d03c9ec4f4a8f1dfe2650a4cc7b1b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,52 +1,54 @@
|
|
1
1
|
require_relative '../../base'
|
2
2
|
|
3
|
-
module CCS
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# The individual panel within a dashboard section
|
9
|
-
#
|
10
|
-
# @!attribute [r] title
|
11
|
-
# @return [String] Text for the panel title
|
12
|
-
# @!attribute [r] href
|
13
|
-
# @return [String] The href for the panel
|
14
|
-
# @!attribute [r] description
|
15
|
-
# @return [String] Description text for the panel
|
16
|
-
|
17
|
-
class Panel < Base
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_reader :title, :href, :description
|
21
|
-
|
22
|
-
public
|
23
|
-
|
24
|
-
# @param title [String] the text for the panel title
|
25
|
-
# @param href [String] the href for the panel
|
26
|
-
# @param description [String] the description text for the panel
|
27
|
-
# @param options [Hash] options that will be used in customising the HTML
|
3
|
+
module CCS
|
4
|
+
module Components
|
5
|
+
module CCS
|
6
|
+
class DashboardSection < Base
|
7
|
+
# = CCS Dashboard Section Panel
|
28
8
|
#
|
29
|
-
#
|
30
|
-
#
|
9
|
+
# The individual panel within a dashboard section
|
10
|
+
#
|
11
|
+
# @!attribute [r] title
|
12
|
+
# @return [String] Text for the panel title
|
13
|
+
# @!attribute [r] href
|
14
|
+
# @return [String] The href for the panel
|
15
|
+
# @!attribute [r] description
|
16
|
+
# @return [String] Description text for the panel
|
31
17
|
|
32
|
-
|
33
|
-
|
18
|
+
class Panel < Base
|
19
|
+
private
|
34
20
|
|
35
|
-
|
21
|
+
attr_reader :title, :href, :description
|
36
22
|
|
37
|
-
|
38
|
-
@href = href
|
39
|
-
@description = description
|
40
|
-
end
|
23
|
+
public
|
41
24
|
|
42
|
-
|
43
|
-
|
44
|
-
|
25
|
+
# @param title [String] the text for the panel title
|
26
|
+
# @param href [String] the href for the panel
|
27
|
+
# @param description [String] the description text for the panel
|
28
|
+
# @param options [Hash] options that will be used in customising the HTML
|
29
|
+
#
|
30
|
+
# @option options [String] :width (default: 'one-third') the width of the panel
|
31
|
+
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
|
32
|
+
|
33
|
+
def initialize(title:, href:, description:, **options)
|
34
|
+
super(**options)
|
35
|
+
|
36
|
+
@options[:attributes][:class] = "ccs-dashboard-section__panel govuk-grid-column-#{@options[:width] || 'one-third'}"
|
37
|
+
|
38
|
+
@title = title
|
39
|
+
@href = href
|
40
|
+
@description = description
|
41
|
+
end
|
42
|
+
|
43
|
+
# Generates the HTML for the CCS Dashboard Section Panel
|
44
|
+
#
|
45
|
+
# @return [ActiveSupport::SafeBuffer]
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
def render
|
48
|
+
tag.div(**options[:attributes]) do
|
49
|
+
concat(link_to(title, href, class: 'ccs-dashboard-section__panel-title'))
|
50
|
+
concat(tag.p(description, class: 'ccs-dashboard-section__panel-description'))
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -1,71 +1,73 @@
|
|
1
1
|
require_relative '../base'
|
2
2
|
require_relative 'dashboard_section/panel'
|
3
3
|
|
4
|
-
module CCS
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
module CCS
|
5
|
+
module Components
|
6
|
+
module CCS
|
7
|
+
# = CCS Dashboard Section
|
8
|
+
#
|
9
|
+
# This is used for generating the dashboard section component
|
10
|
+
#
|
11
|
+
# @!attribute [r] dashboard_section_panels
|
12
|
+
# @return [Array<Link>] An array of the initialised dashboard section panels
|
13
|
+
# @!attribute [r] title_text
|
14
|
+
# @return [String] Text for the title of a dashboard section
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
class DashboardSection < Base
|
17
|
+
private
|
17
18
|
|
18
|
-
|
19
|
+
attr_reader :dashboard_section_panels, :title_text
|
19
20
|
|
20
|
-
|
21
|
+
public
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
# @param dashboard_section_panels [Array<Hash>] An array of options for the dashboard section panels,
|
24
|
+
# See {Components::CCS::DashboardSection::Panel#initialize Panel#initialize} for details of the items in the array.
|
25
|
+
# @param title_text [String] text for the title of a dashboard section
|
26
|
+
# @param options [Hash] options that will be used in customising the HTML
|
27
|
+
#
|
28
|
+
# @option options [String] :classes additional CSS classes for the dashboard section HTML
|
29
|
+
# @option options [String] :width (default: 'full') the width of the dashboard section
|
30
|
+
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
def initialize(dashboard_section_panels:, title_text: nil, **options)
|
33
|
+
super(**options)
|
33
34
|
|
34
|
-
|
35
|
+
@options[:width] ||= 'full'
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
@dashboard_section_panels = dashboard_section_panels.map { |dashboard_section_panel| Panel.new(context: @context, **dashboard_section_panel) }
|
38
|
+
@title_text = title_text
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
+
# rubocop:disable Metrics/AbcSize
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
# Generates the HTML for the CCS dashboard section component
|
44
|
+
#
|
45
|
+
# @return [ActiveSupport::SafeBuffer]
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
concat(tag.div(class: 'ccs-dashboard-section__container') do
|
55
|
-
tag.div(class: 'govuk-grid-row') do
|
56
|
-
dashboard_section_panels.each { |dashboard_section_panel| concat(dashboard_section_panel.render) }
|
47
|
+
def render
|
48
|
+
tag.div(**options[:attributes]) do
|
49
|
+
tag.div(class: 'govuk-grid-row') do
|
50
|
+
tag.div(class: "govuk-grid-column-#{options[:width]}") do
|
51
|
+
if title_text
|
52
|
+
concat(tag.h2(title_text, class: 'ccs-dashboard-section__heading govuk-heading-m'))
|
53
|
+
concat(tag.hr(class: 'ccs-dashboard-section__heading-section-break govuk-section-break govuk-section-break--visible'))
|
57
54
|
end
|
58
|
-
|
55
|
+
concat(tag.div(class: 'ccs-dashboard-section__container') do
|
56
|
+
tag.div(class: 'govuk-grid-row') do
|
57
|
+
dashboard_section_panels.each { |dashboard_section_panel| concat(dashboard_section_panel.render) }
|
58
|
+
end
|
59
|
+
end)
|
60
|
+
end
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
62
|
-
end
|
63
64
|
|
64
|
-
|
65
|
+
# rubocop:enable Metrics/AbcSize
|
65
66
|
|
66
|
-
|
67
|
+
# The default attributes for the dashboard section
|
67
68
|
|
68
|
-
|
69
|
+
DEFAULT_ATTRIBUTES = { class: 'ccs-dashboard-section' }.freeze
|
70
|
+
end
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
@@ -1,50 +1,52 @@
|
|
1
1
|
require_relative '../../base'
|
2
2
|
|
3
|
-
module CCS
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# The individual footer footer link item
|
9
|
-
#
|
10
|
-
# @!attribute [r] text
|
11
|
-
# @return [String] Text for the footer link
|
12
|
-
# @!attribute [r] href
|
13
|
-
# @return [String] The href for the footer link
|
14
|
-
# @!attribute [r] li_class
|
15
|
-
# @return [String] The class for the li elements
|
16
|
-
|
17
|
-
class Link < Base
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_reader :text, :href, :li_class
|
21
|
-
|
22
|
-
public
|
23
|
-
|
24
|
-
# @param text [String] the text for the footer link
|
25
|
-
# @param href [String] the href for the footer link
|
26
|
-
# @param li_class [String] class for the li elements
|
27
|
-
# @param options [Hash] options that will be used in customising the HTML
|
3
|
+
module CCS
|
4
|
+
module Components
|
5
|
+
module CCS
|
6
|
+
class Footer < Base
|
7
|
+
# = CCS Footer link
|
28
8
|
#
|
29
|
-
#
|
9
|
+
# The individual footer footer link item
|
10
|
+
#
|
11
|
+
# @!attribute [r] text
|
12
|
+
# @return [String] Text for the footer link
|
13
|
+
# @!attribute [r] href
|
14
|
+
# @return [String] The href for the footer link
|
15
|
+
# @!attribute [r] li_class
|
16
|
+
# @return [String] The class for the li elements
|
30
17
|
|
31
|
-
|
32
|
-
|
18
|
+
class Link < Base
|
19
|
+
private
|
33
20
|
|
34
|
-
|
35
|
-
@href = href
|
36
|
-
@li_class = li_class
|
37
|
-
end
|
21
|
+
attr_reader :text, :href, :li_class
|
38
22
|
|
39
|
-
|
40
|
-
|
41
|
-
|
23
|
+
public
|
24
|
+
|
25
|
+
# @param text [String] the text for the footer link
|
26
|
+
# @param href [String] the href for the footer link
|
27
|
+
# @param li_class [String] class for the li elements
|
28
|
+
# @param options [Hash] options that will be used in customising the HTML
|
29
|
+
#
|
30
|
+
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
31
|
+
|
32
|
+
def initialize(text:, href:, li_class:, **options)
|
33
|
+
super(**options)
|
34
|
+
|
35
|
+
@text = text
|
36
|
+
@href = href
|
37
|
+
@li_class = li_class
|
38
|
+
end
|
39
|
+
|
40
|
+
# Generates the HTML for the CCS Footer link
|
41
|
+
#
|
42
|
+
# @return [ActiveSupport::SafeBuffer]
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
def render
|
45
|
+
tag.li(class: li_class) do
|
46
|
+
options[:attributes][:class] = 'ccs-footer__link'
|
46
47
|
|
47
|
-
|
48
|
+
link_to(text, href, **options[:attributes])
|
49
|
+
end
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
@@ -1,55 +1,56 @@
|
|
1
|
-
require_relative '../../base'
|
2
1
|
require_relative 'link'
|
3
2
|
|
4
|
-
module CCS
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# @!attribute [r] meta_links
|
12
|
-
# @return [Array<Link>] An array of the initialised meta links
|
13
|
-
# @!attribute [r] visually_hidden_title
|
14
|
-
# @return [String] Title for the meta section
|
15
|
-
# @!attribute [r] text
|
16
|
-
# @return [String] Text to add to the meta section of the footer
|
17
|
-
|
18
|
-
class Meta
|
19
|
-
include ActionView::Context
|
20
|
-
include ActionView::Helpers
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_reader :meta_links, :visually_hidden_title, :text
|
25
|
-
|
26
|
-
public
|
27
|
-
|
28
|
-
# @param items [Array<Hash>] an array of links for the meta section.
|
29
|
-
# See {Components::CCS::Footer::Link#initialize Link#initialize} for details of the items in the array.
|
30
|
-
# @param visually_hidden_title [String] ('Support links') title for the meta section
|
31
|
-
# @param text [String] text to add to the meta section of the footer
|
32
|
-
# @param context [ActionView::Base] the view context
|
33
|
-
|
34
|
-
def initialize(context:, items: nil, visually_hidden_title: nil, text: nil)
|
35
|
-
@meta_links = items&.map { |meta_link| Link.new(li_class: 'ccs-footer__inline-list-item', context: context, **meta_link) }
|
36
|
-
@visually_hidden_title = visually_hidden_title || 'Support links'
|
37
|
-
@text = text
|
38
|
-
end
|
39
|
-
|
40
|
-
# Generates the HTML for the CCS Footer Meta sections
|
3
|
+
module CCS
|
4
|
+
module Components
|
5
|
+
module CCS
|
6
|
+
class Footer < Base
|
7
|
+
# = CCS Footer Meta
|
8
|
+
#
|
9
|
+
# The footer meta section
|
41
10
|
#
|
42
|
-
#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
11
|
+
# @!attribute [r] meta_links
|
12
|
+
# @return [Array<Link>] An array of the initialised meta links
|
13
|
+
# @!attribute [r] visually_hidden_title
|
14
|
+
# @return [String] Title for the meta section
|
15
|
+
# @!attribute [r] text
|
16
|
+
# @return [String] Text to add to the meta section of the footer
|
17
|
+
|
18
|
+
class Meta
|
19
|
+
include ActionView::Context
|
20
|
+
include ActionView::Helpers
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :meta_links, :visually_hidden_title, :text
|
25
|
+
|
26
|
+
public
|
27
|
+
|
28
|
+
# @param items [Array<Hash>] an array of links for the meta section.
|
29
|
+
# See {Components::CCS::Footer::Link#initialize Link#initialize} for details of the items in the array.
|
30
|
+
# @param visually_hidden_title [String] ('Support links') title for the meta section
|
31
|
+
# @param text [String] text to add to the meta section of the footer
|
32
|
+
# @param context [ActionView::Base] the view context
|
33
|
+
|
34
|
+
def initialize(context:, items: nil, visually_hidden_title: nil, text: nil)
|
35
|
+
@meta_links = items&.map { |meta_link| Link.new(li_class: 'ccs-footer__inline-list-item', context: context, **meta_link) }
|
36
|
+
@visually_hidden_title = visually_hidden_title || 'Support links'
|
37
|
+
@text = text
|
38
|
+
end
|
39
|
+
|
40
|
+
# Generates the HTML for the CCS Footer Meta sections
|
41
|
+
#
|
42
|
+
# @return [ActiveSupport::SafeBuffer]
|
43
|
+
|
44
|
+
def render
|
45
|
+
capture do
|
46
|
+
concat(tag.h2(visually_hidden_title, class: 'govuk-visually-hidden'))
|
47
|
+
if meta_links
|
48
|
+
concat(tag.ul(class: 'ccs-footer__inline-list') do
|
49
|
+
meta_links.each { |meta_link| concat(meta_link.render) }
|
50
|
+
end)
|
51
|
+
end
|
52
|
+
concat(tag.div(text, class: 'ccs-footer__meta-custom')) if text
|
51
53
|
end
|
52
|
-
concat(tag.div(text, class: 'ccs-footer__meta-custom')) if text
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
@@ -1,56 +1,57 @@
|
|
1
|
-
require_relative '../../base'
|
2
1
|
require_relative 'link'
|
3
2
|
|
4
|
-
module CCS
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# @!attribute [r] title
|
12
|
-
# @return [String] Title for the navigation section
|
13
|
-
# @!attribute [r] navigation_links
|
14
|
-
# @return [Array<Link>] An array of the initialised navigation links
|
15
|
-
# @!attribute [r] width
|
16
|
-
# @return [String] Width of the navigation section
|
17
|
-
# @!attribute [r] columns
|
18
|
-
# @return [Integer] Number of columns to display the links in
|
19
|
-
|
20
|
-
class Navigation
|
21
|
-
include ActionView::Context
|
22
|
-
include ActionView::Helpers
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
attr_reader :title, :navigation_links, :width, :columns
|
27
|
-
|
28
|
-
public
|
29
|
-
|
30
|
-
# @param title [String] the title for the navigation section
|
31
|
-
# @param items [Array<Hash>] an array of links for the navigation section.
|
32
|
-
# See {Components::CCS::Footer::Link#initialize Link#initialize} for details of the items in the array.
|
33
|
-
# @param width [String] ('full') width of each navigation section in the footer
|
34
|
-
# @param columns [Integer] (nil) number of columns to display the links
|
35
|
-
# @param context [ActionView::Base] the view context
|
36
|
-
|
37
|
-
def initialize(title:, items:, context:, width: nil, columns: nil)
|
38
|
-
@title = title
|
39
|
-
@navigation_links = items.map { |navigation_link| Link.new(li_class: 'ccs-footer__list-item', context: context, **navigation_link) }
|
40
|
-
@width = width || 'full'
|
41
|
-
@columns = columns
|
42
|
-
end
|
43
|
-
|
44
|
-
# Generates the HTML for the CCS Footer Navigation sections
|
3
|
+
module CCS
|
4
|
+
module Components
|
5
|
+
module CCS
|
6
|
+
class Footer < Base
|
7
|
+
# = CCS Footer Navigation
|
8
|
+
#
|
9
|
+
# The individual footer navigation item
|
45
10
|
#
|
46
|
-
#
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
11
|
+
# @!attribute [r] title
|
12
|
+
# @return [String] Title for the navigation section
|
13
|
+
# @!attribute [r] navigation_links
|
14
|
+
# @return [Array<Link>] An array of the initialised navigation links
|
15
|
+
# @!attribute [r] width
|
16
|
+
# @return [String] Width of the navigation section
|
17
|
+
# @!attribute [r] columns
|
18
|
+
# @return [Integer] Number of columns to display the links in
|
19
|
+
|
20
|
+
class Navigation
|
21
|
+
include ActionView::Context
|
22
|
+
include ActionView::Helpers
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :title, :navigation_links, :width, :columns
|
27
|
+
|
28
|
+
public
|
29
|
+
|
30
|
+
# @param title [String] the title for the navigation section
|
31
|
+
# @param items [Array<Hash>] an array of links for the navigation section.
|
32
|
+
# See {Components::CCS::Footer::Link#initialize Link#initialize} for details of the items in the array.
|
33
|
+
# @param width [String] ('full') width of each navigation section in the footer
|
34
|
+
# @param columns [Integer] (nil) number of columns to display the links
|
35
|
+
# @param context [ActionView::Base] the view context
|
36
|
+
|
37
|
+
def initialize(title:, items:, context:, width: nil, columns: nil)
|
38
|
+
@title = title
|
39
|
+
@navigation_links = items.map { |navigation_link| Link.new(li_class: 'ccs-footer__list-item', context: context, **navigation_link) }
|
40
|
+
@width = width || 'full'
|
41
|
+
@columns = columns
|
42
|
+
end
|
43
|
+
|
44
|
+
# Generates the HTML for the CCS Footer Navigation sections
|
45
|
+
#
|
46
|
+
# @return [ActiveSupport::SafeBuffer]
|
47
|
+
|
48
|
+
def render
|
49
|
+
tag.div(class: "ccs-footer__section govuk-grid-column-#{width}") do
|
50
|
+
concat(tag.h2(title, class: 'ccs-footer__heading govuk-heading-m'))
|
51
|
+
concat(tag.ul(class: "ccs-footer__list #{"ccs-footer__list--columns-#{columns}" if columns}".rstrip) do
|
52
|
+
navigation_links.each { |navigation_link| concat(navigation_link.render) }
|
53
|
+
end)
|
54
|
+
end
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|