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.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/Gemfile.lock +1 -1
  4. data/lib/ccs/components/ccs/dashboard_section/panel.rb +43 -41
  5. data/lib/ccs/components/ccs/dashboard_section.rb +50 -48
  6. data/lib/ccs/components/ccs/footer/link.rb +41 -39
  7. data/lib/ccs/components/ccs/footer/meta.rb +49 -48
  8. data/lib/ccs/components/ccs/footer/navigation.rb +51 -50
  9. data/lib/ccs/components/ccs/footer.rb +69 -67
  10. data/lib/ccs/components/ccs/header/link.rb +47 -45
  11. data/lib/ccs/components/ccs/header/navigation.rb +85 -84
  12. data/lib/ccs/components/ccs/header/service_authentication.rb +35 -34
  13. data/lib/ccs/components/ccs/header.rb +87 -85
  14. data/lib/ccs/components/ccs/logo.rb +36 -34
  15. data/lib/ccs/components/govuk/accordion/section/content.rb +42 -42
  16. data/lib/ccs/components/govuk/accordion/section/header.rb +48 -48
  17. data/lib/ccs/components/govuk/accordion/section.rb +49 -48
  18. data/lib/ccs/components/govuk/accordion.rb +43 -41
  19. data/lib/ccs/components/govuk/back_link.rb +39 -37
  20. data/lib/ccs/components/govuk/breadcrumbs/link.rb +42 -40
  21. data/lib/ccs/components/govuk/breadcrumbs.rb +40 -38
  22. data/lib/ccs/components/govuk/button.rb +83 -81
  23. data/lib/ccs/components/govuk/cookie_banner/action.rb +45 -43
  24. data/lib/ccs/components/govuk/cookie_banner/message.rb +57 -55
  25. data/lib/ccs/components/govuk/cookie_banner.rb +40 -38
  26. data/lib/ccs/components/govuk/details.rb +38 -36
  27. data/lib/ccs/components/govuk/error_message.rb +46 -44
  28. data/lib/ccs/components/govuk/error_summary/item.rb +41 -39
  29. data/lib/ccs/components/govuk/error_summary.rb +49 -47
  30. data/lib/ccs/components/govuk/field/input/character_count.rb +101 -99
  31. data/lib/ccs/components/govuk/field/input/file_upload.rb +29 -27
  32. data/lib/ccs/components/govuk/field/input/select.rb +61 -59
  33. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +39 -37
  34. data/lib/ccs/components/govuk/field/input/text_input.rb +75 -73
  35. data/lib/ccs/components/govuk/field/input/textarea.rb +43 -41
  36. data/lib/ccs/components/govuk/field/input.rb +46 -44
  37. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +43 -41
  38. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +48 -46
  39. data/lib/ccs/components/govuk/field/inputs/date_input.rb +68 -66
  40. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +29 -27
  41. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +26 -24
  42. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +32 -30
  43. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +39 -37
  44. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +27 -25
  45. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +26 -24
  46. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +32 -30
  47. data/lib/ccs/components/govuk/field/inputs/item.rb +100 -98
  48. data/lib/ccs/components/govuk/field/inputs/radios.rb +43 -41
  49. data/lib/ccs/components/govuk/field/inputs.rb +42 -40
  50. data/lib/ccs/components/govuk/field.rb +90 -88
  51. data/lib/ccs/components/govuk/fieldset/legend.rb +50 -48
  52. data/lib/ccs/components/govuk/fieldset.rb +40 -38
  53. data/lib/ccs/components/govuk/footer/link.rb +41 -39
  54. data/lib/ccs/components/govuk/footer/meta.rb +49 -48
  55. data/lib/ccs/components/govuk/footer/navigation.rb +51 -50
  56. data/lib/ccs/components/govuk/footer.rb +105 -103
  57. data/lib/ccs/components/govuk/form_group.rb +45 -43
  58. data/lib/ccs/components/govuk/header/link.rb +41 -39
  59. data/lib/ccs/components/govuk/header/navigation.rb +54 -53
  60. data/lib/ccs/components/govuk/header.rb +84 -82
  61. data/lib/ccs/components/govuk/hint.rb +33 -31
  62. data/lib/ccs/components/govuk/inset_text.rb +39 -37
  63. data/lib/ccs/components/govuk/label.rb +61 -59
  64. data/lib/ccs/components/govuk/notification_banner.rb +83 -81
  65. data/lib/ccs/components/govuk/pagination/increment/next.rb +29 -27
  66. data/lib/ccs/components/govuk/pagination/increment/previous.rb +28 -26
  67. data/lib/ccs/components/govuk/pagination/increment.rb +78 -76
  68. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +17 -15
  69. data/lib/ccs/components/govuk/pagination/item/form.rb +34 -32
  70. data/lib/ccs/components/govuk/pagination/item/tag.rb +33 -31
  71. data/lib/ccs/components/govuk/pagination/item.rb +47 -45
  72. data/lib/ccs/components/govuk/pagination.rb +69 -67
  73. data/lib/ccs/components/govuk/panel.rb +49 -47
  74. data/lib/ccs/components/govuk/phase_banner.rb +50 -48
  75. data/lib/ccs/components/govuk/skip_link.rb +39 -37
  76. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +40 -38
  77. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +30 -28
  78. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +28 -26
  79. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +47 -45
  80. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +49 -47
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +44 -42
  82. data/lib/ccs/components/govuk/step_by_step_navigation.rb +41 -39
  83. data/lib/ccs/components/govuk/summary_list/action/link.rb +46 -44
  84. data/lib/ccs/components/govuk/summary_list/card/actions.rb +38 -36
  85. data/lib/ccs/components/govuk/summary_list/card/title.rb +37 -35
  86. data/lib/ccs/components/govuk/summary_list/card.rb +48 -46
  87. data/lib/ccs/components/govuk/summary_list/row/actions.rb +38 -36
  88. data/lib/ccs/components/govuk/summary_list/row/key.rb +30 -28
  89. data/lib/ccs/components/govuk/summary_list/row/value.rb +30 -28
  90. data/lib/ccs/components/govuk/summary_list/row.rb +47 -45
  91. data/lib/ccs/components/govuk/summary_list.rb +48 -46
  92. data/lib/ccs/components/govuk/table/body/data_cell.rb +38 -36
  93. data/lib/ccs/components/govuk/table/body/head_cell.rb +37 -35
  94. data/lib/ccs/components/govuk/table/header/head_cell.rb +39 -37
  95. data/lib/ccs/components/govuk/table.rb +83 -81
  96. data/lib/ccs/components/govuk/tabs/panel.rb +47 -45
  97. data/lib/ccs/components/govuk/tabs/tab.rb +42 -40
  98. data/lib/ccs/components/govuk/tabs.rb +48 -46
  99. data/lib/ccs/components/govuk/tag.rb +39 -37
  100. data/lib/ccs/components/govuk/warning_text.rb +49 -47
  101. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +16 -14
  102. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +17 -15
  103. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +17 -15
  104. data/lib/ccs/frontend_helpers/ccs_frontend.rb +1 -1
  105. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +17 -15
  106. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +17 -15
  107. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +17 -15
  108. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +17 -15
  109. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +17 -15
  110. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +17 -15
  111. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +17 -15
  112. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +17 -15
  113. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +19 -17
  114. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +32 -30
  115. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +38 -36
  116. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +19 -17
  117. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +17 -15
  118. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +17 -15
  119. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +27 -25
  120. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +17 -15
  121. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +18 -16
  122. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +17 -15
  123. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +19 -17
  124. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +18 -16
  125. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +19 -17
  126. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +17 -15
  127. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +19 -17
  128. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +19 -17
  129. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +17 -15
  130. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +17 -15
  131. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +17 -15
  132. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +24 -22
  133. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +17 -15
  134. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +17 -15
  135. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +17 -15
  136. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +17 -15
  137. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +17 -15
  138. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +19 -17
  139. data/lib/ccs/frontend_helpers/version.rb +1 -1
  140. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8953dff436dfc45a5f342ee8914f5e784ab794670e6bf3ddb8490b5a4405044
4
- data.tar.gz: 95a5eb7c860225423cab0f0a7876357195e078e8b4a101efdf9540a7fec8d96a
3
+ metadata.gz: 675c60c51c25d5cd22e26b1e92a579053d1340200bc4a33e9a4e36e65b6790ca
4
+ data.tar.gz: b90658aa1deadfa04ee5dd2d12be7f8a62b83656017a0fc557812fced67a789f
5
5
  SHA512:
6
- metadata.gz: c18444fc0a1442a00be351944e9d23cd32800da85e73b2b57c6c150a3b75b87f01ae8c6e520092439f35ac45bccd63c1d390a1935b1d8d4e41427cff229161e1
7
- data.tar.gz: e44027d75f86627f1360be7bc60e3e3c149de32a4847dbf8fc7c6f188a9951882e46347849f24f8cb28fc720f0de54a45e3e005fa36b7bc4877181f495bba54c
6
+ metadata.gz: d5ec2d542ec51558264bfd069546b59969ff401fc1c49c0b332ea547ce7504e477d8dd01ae50f16a7b322d1e80b3d5e584d540259c398090b5aba10af240cd33
7
+ data.tar.gz: 93ed922f0db520239e8d27bf422ebf9badaad94cd014f7af431e6009d5d1ba4b9ffb96cfca565e7e7ff1ed2d4912a2f7189d03c9ec4f4a8f1dfe2650a4cc7b1b
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.1.0] - 2023-02-22
1
+ ## [0.1.0.rc.3] - 2023-04-05
2
2
 
3
3
  Initial release of CCS Frontend Helpers.
4
4
  This release contains view helpers that are used to create GOV.UK and CCS components.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.0.rc.2)
4
+ ccs-frontend_helpers (0.1.0.rc.3)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
@@ -1,52 +1,54 @@
1
1
  require_relative '../../base'
2
2
 
3
- module CCS::Components
4
- module CCS
5
- class DashboardSection < Base
6
- # = CCS Dashboard Section Panel
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
- # @option options [String] :width (default: 'one-third') the width of the panel
30
- # @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
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
- def initialize(title:, href:, description:, **options)
33
- super(**options)
18
+ class Panel < Base
19
+ private
34
20
 
35
- @options[:attributes][:class] = "ccs-dashboard-section__panel govuk-grid-column-#{@options[:width] || 'one-third'}"
21
+ attr_reader :title, :href, :description
36
22
 
37
- @title = title
38
- @href = href
39
- @description = description
40
- end
23
+ public
41
24
 
42
- # Generates the HTML for the CCS Dashboard Section Panel
43
- #
44
- # @return [ActiveSupport::SafeBuffer]
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
- def render
47
- tag.div(**options[:attributes]) do
48
- concat(link_to(title, href, class: 'ccs-dashboard-section__panel-title'))
49
- concat(tag.p(description, class: 'ccs-dashboard-section__panel-description'))
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::Components
5
- module CCS
6
- # = CCS Dashboard Section
7
- #
8
- # This is used for generating the dashboard section component
9
- #
10
- # @!attribute [r] dashboard_section_panels
11
- # @return [Array<Link>] An array of the initialised dashboard section panels
12
- # @!attribute [r] title_text
13
- # @return [String] Text for the title of a dashboard section
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
- class DashboardSection < Base
16
- private
16
+ class DashboardSection < Base
17
+ private
17
18
 
18
- attr_reader :dashboard_section_panels, :title_text
19
+ attr_reader :dashboard_section_panels, :title_text
19
20
 
20
- public
21
+ public
21
22
 
22
- # @param dashboard_section_panels [Array<Hash>] An array of options for the dashboard section panels,
23
- # See {Components::CCS::DashboardSection::Panel#initialize Panel#initialize} for details of the items in the array.
24
- # @param title_text [String] text for the title of a dashboard section
25
- # @param options [Hash] options that will be used in customising the HTML
26
- #
27
- # @option options [String] :classes additional CSS classes for the dashboard section HTML
28
- # @option options [String] :width (default: 'full') the width of the dashboard section
29
- # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
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
- def initialize(dashboard_section_panels:, title_text: nil, **options)
32
- super(**options)
32
+ def initialize(dashboard_section_panels:, title_text: nil, **options)
33
+ super(**options)
33
34
 
34
- @options[:width] ||= 'full'
35
+ @options[:width] ||= 'full'
35
36
 
36
- @dashboard_section_panels = dashboard_section_panels.map { |dashboard_section_panel| Panel.new(context: @context, **dashboard_section_panel) }
37
- @title_text = title_text
38
- end
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
- # rubocop:disable Metrics/AbcSize
41
+ # rubocop:disable Metrics/AbcSize
41
42
 
42
- # Generates the HTML for the CCS dashboard section component
43
- #
44
- # @return [ActiveSupport::SafeBuffer]
43
+ # Generates the HTML for the CCS dashboard section component
44
+ #
45
+ # @return [ActiveSupport::SafeBuffer]
45
46
 
46
- def render
47
- tag.div(**options[:attributes]) do
48
- tag.div(class: 'govuk-grid-row') do
49
- tag.div(class: "govuk-grid-column-#{options[:width]}") do
50
- if title_text
51
- concat(tag.h2(title_text, class: 'ccs-dashboard-section__heading govuk-heading-m'))
52
- concat(tag.hr(class: 'ccs-dashboard-section__heading-section-break govuk-section-break govuk-section-break--visible'))
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
- end)
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
- # rubocop:enable Metrics/AbcSize
65
+ # rubocop:enable Metrics/AbcSize
65
66
 
66
- # The default attributes for the dashboard section
67
+ # The default attributes for the dashboard section
67
68
 
68
- DEFAULT_ATTRIBUTES = { class: 'ccs-dashboard-section' }.freeze
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::Components
4
- module CCS
5
- class Footer < Base
6
- # = CCS Footer link
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
- # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
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
- def initialize(text:, href:, li_class:, **options)
32
- super(**options)
18
+ class Link < Base
19
+ private
33
20
 
34
- @text = text
35
- @href = href
36
- @li_class = li_class
37
- end
21
+ attr_reader :text, :href, :li_class
38
22
 
39
- # Generates the HTML for the CCS Footer link
40
- #
41
- # @return [ActiveSupport::SafeBuffer]
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
- def render
44
- tag.li(class: li_class) do
45
- options[:attributes][:class] = 'ccs-footer__link'
44
+ def render
45
+ tag.li(class: li_class) do
46
+ options[:attributes][:class] = 'ccs-footer__link'
46
47
 
47
- link_to(text, href, **options[:attributes])
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::Components
5
- module CCS
6
- class Footer < Base
7
- # = CCS Footer Meta
8
- #
9
- # The footer meta section
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
- # @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)
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::Components
5
- module CCS
6
- class Footer < Base
7
- # = CCS Footer Navigation
8
- #
9
- # The individual footer navigation item
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
- # @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)
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