ccs-frontend_helpers 0.1.0.rc.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -5
  3. data/CHANGELOG.md +2 -4
  4. data/Gemfile +1 -15
  5. data/Gemfile.lock +80 -81
  6. data/ccs-frontend_helpers.gemspec +10 -0
  7. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_panels.rb +79 -0
  8. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +119 -6
  9. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +183 -6
  10. data/lib/ccs/{components/ccs → frontend_helpers/ccs_frontend}/logo.rb +12 -10
  11. data/lib/ccs/frontend_helpers/ccs_frontend.rb +4 -2
  12. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +95 -8
  13. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +17 -6
  14. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +54 -6
  15. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +105 -6
  16. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +114 -6
  17. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +23 -7
  18. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +32 -11
  19. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +65 -13
  20. data/lib/ccs/frontend_helpers/govuk_frontend/field/character_count.rb +165 -0
  21. data/lib/ccs/frontend_helpers/govuk_frontend/field/checkboxes.rb +200 -0
  22. data/lib/ccs/frontend_helpers/govuk_frontend/field/date_input.rb +153 -0
  23. data/lib/ccs/frontend_helpers/govuk_frontend/field/file_upload.rb +83 -0
  24. data/lib/ccs/frontend_helpers/govuk_frontend/field/input.rb +153 -0
  25. data/lib/ccs/frontend_helpers/govuk_frontend/field/radios.rb +201 -0
  26. data/lib/ccs/frontend_helpers/govuk_frontend/field/select.rb +124 -0
  27. data/lib/ccs/frontend_helpers/govuk_frontend/field/textarea.rb +106 -0
  28. data/lib/ccs/frontend_helpers/govuk_frontend/field.rb +213 -0
  29. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +48 -7
  30. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +161 -6
  31. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +24 -13
  32. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +139 -6
  33. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +17 -8
  34. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +21 -7
  35. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +70 -7
  36. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +113 -7
  37. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +314 -6
  38. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +28 -7
  39. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +27 -8
  40. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +18 -6
  41. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +186 -7
  42. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +204 -6
  43. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +100 -11
  44. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +73 -6
  45. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +21 -7
  46. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +30 -7
  47. data/lib/ccs/frontend_helpers/govuk_frontend.rb +19 -17
  48. data/lib/ccs/frontend_helpers/shared_methods.rb +27 -0
  49. data/lib/ccs/frontend_helpers/version.rb +1 -1
  50. metadata +142 -112
  51. data/.ruby-version +0 -1
  52. data/lib/ccs/components/base.rb +0 -64
  53. data/lib/ccs/components/ccs/dashboard_section/panel.rb +0 -57
  54. data/lib/ccs/components/ccs/dashboard_section.rb +0 -71
  55. data/lib/ccs/components/ccs/footer/link.rb +0 -55
  56. data/lib/ccs/components/ccs/footer/meta.rb +0 -59
  57. data/lib/ccs/components/ccs/footer/navigation.rb +0 -60
  58. data/lib/ccs/components/ccs/footer.rb +0 -95
  59. data/lib/ccs/components/ccs/header/link.rb +0 -60
  60. data/lib/ccs/components/ccs/header/navigation.rb +0 -98
  61. data/lib/ccs/components/ccs/header/service_authentication.rb +0 -53
  62. data/lib/ccs/components/ccs/header.rb +0 -110
  63. data/lib/ccs/components/govuk/accordion/section/content.rb +0 -53
  64. data/lib/ccs/components/govuk/accordion/section/header.rb +0 -57
  65. data/lib/ccs/components/govuk/accordion/section.rb +0 -61
  66. data/lib/ccs/components/govuk/accordion.rb +0 -58
  67. data/lib/ccs/components/govuk/back_link.rb +0 -51
  68. data/lib/ccs/components/govuk/breadcrumbs/link.rb +0 -57
  69. data/lib/ccs/components/govuk/breadcrumbs.rb +0 -55
  70. data/lib/ccs/components/govuk/button.rb +0 -107
  71. data/lib/ccs/components/govuk/cookie_banner/action.rb +0 -60
  72. data/lib/ccs/components/govuk/cookie_banner/message.rb +0 -80
  73. data/lib/ccs/components/govuk/cookie_banner.rb +0 -55
  74. data/lib/ccs/components/govuk/details.rb +0 -53
  75. data/lib/ccs/components/govuk/error_message.rb +0 -60
  76. data/lib/ccs/components/govuk/error_summary/item.rb +0 -54
  77. data/lib/ccs/components/govuk/error_summary.rb +0 -70
  78. data/lib/ccs/components/govuk/field/input/character_count.rb +0 -129
  79. data/lib/ccs/components/govuk/field/input/file_upload.rb +0 -44
  80. data/lib/ccs/components/govuk/field/input/select.rb +0 -82
  81. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +0 -55
  82. data/lib/ccs/components/govuk/field/input/text_input.rb +0 -97
  83. data/lib/ccs/components/govuk/field/input/textarea.rb +0 -59
  84. data/lib/ccs/components/govuk/field/input.rb +0 -62
  85. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +0 -69
  86. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +0 -65
  87. data/lib/ccs/components/govuk/field/inputs/date_input.rb +0 -89
  88. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +0 -47
  89. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +0 -43
  90. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +0 -50
  91. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +0 -50
  92. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +0 -44
  93. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +0 -43
  94. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +0 -50
  95. data/lib/ccs/components/govuk/field/inputs/item.rb +0 -111
  96. data/lib/ccs/components/govuk/field/inputs/radios.rb +0 -69
  97. data/lib/ccs/components/govuk/field/inputs.rb +0 -57
  98. data/lib/ccs/components/govuk/field.rb +0 -108
  99. data/lib/ccs/components/govuk/fieldset/legend.rb +0 -65
  100. data/lib/ccs/components/govuk/fieldset.rb +0 -54
  101. data/lib/ccs/components/govuk/footer/link.rb +0 -55
  102. data/lib/ccs/components/govuk/footer/meta.rb +0 -59
  103. data/lib/ccs/components/govuk/footer/navigation.rb +0 -60
  104. data/lib/ccs/components/govuk/footer.rb +0 -131
  105. data/lib/ccs/components/govuk/form_group.rb +0 -60
  106. data/lib/ccs/components/govuk/header/link.rb +0 -56
  107. data/lib/ccs/components/govuk/header/navigation.rb +0 -71
  108. data/lib/ccs/components/govuk/header.rb +0 -107
  109. data/lib/ccs/components/govuk/hint.rb +0 -49
  110. data/lib/ccs/components/govuk/inset_text.rb +0 -52
  111. data/lib/ccs/components/govuk/label.rb +0 -85
  112. data/lib/ccs/components/govuk/notification_banner.rb +0 -107
  113. data/lib/ccs/components/govuk/pagination/increment/next.rb +0 -44
  114. data/lib/ccs/components/govuk/pagination/increment/previous.rb +0 -43
  115. data/lib/ccs/components/govuk/pagination/increment.rb +0 -98
  116. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +0 -28
  117. data/lib/ccs/components/govuk/pagination/item/form.rb +0 -49
  118. data/lib/ccs/components/govuk/pagination/item/tag.rb +0 -47
  119. data/lib/ccs/components/govuk/pagination/item.rb +0 -64
  120. data/lib/ccs/components/govuk/pagination.rb +0 -96
  121. data/lib/ccs/components/govuk/panel.rb +0 -62
  122. data/lib/ccs/components/govuk/phase_banner.rb +0 -69
  123. data/lib/ccs/components/govuk/skip_link.rb +0 -51
  124. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +0 -53
  125. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +0 -50
  126. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +0 -45
  127. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +0 -63
  128. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +0 -69
  129. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +0 -56
  130. data/lib/ccs/components/govuk/step_by_step_navigation.rb +0 -59
  131. data/lib/ccs/components/govuk/summary_list/action/link.rb +0 -59
  132. data/lib/ccs/components/govuk/summary_list/card/actions.rb +0 -59
  133. data/lib/ccs/components/govuk/summary_list/card/title.rb +0 -51
  134. data/lib/ccs/components/govuk/summary_list/card.rb +0 -63
  135. data/lib/ccs/components/govuk/summary_list/row/actions.rb +0 -59
  136. data/lib/ccs/components/govuk/summary_list/row/key.rb +0 -47
  137. data/lib/ccs/components/govuk/summary_list/row/value.rb +0 -47
  138. data/lib/ccs/components/govuk/summary_list/row.rb +0 -67
  139. data/lib/ccs/components/govuk/summary_list.rb +0 -74
  140. data/lib/ccs/components/govuk/table/body/data_cell.rb +0 -53
  141. data/lib/ccs/components/govuk/table/body/head_cell.rb +0 -52
  142. data/lib/ccs/components/govuk/table/header/head_cell.rb +0 -54
  143. data/lib/ccs/components/govuk/table.rb +0 -111
  144. data/lib/ccs/components/govuk/tabs/panel.rb +0 -58
  145. data/lib/ccs/components/govuk/tabs/tab.rb +0 -56
  146. data/lib/ccs/components/govuk/tabs.rb +0 -66
  147. data/lib/ccs/components/govuk/tag.rb +0 -51
  148. data/lib/ccs/components/govuk/warning_text.rb +0 -61
  149. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +0 -27
  150. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +0 -28
  151. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +0 -28
  152. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +0 -28
  153. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +0 -28
  154. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +0 -28
  155. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +0 -28
  156. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +0 -28
  157. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 376385395af1b119139c7132e1c965f14c26e30496c72721a8b5d83a9b0a1b31
4
- data.tar.gz: cfdd0913eaa1daf7b215d03eb2d84e446427507a84de38015dd27a5448a5d7e6
3
+ metadata.gz: c5a550b15fe6ba2415299994f716d842c129687e2c5fe8e124fbbf09332913d7
4
+ data.tar.gz: a9be14a1105948400e4445694e339981b9a1e51cdb9d9c8111a01f2f35dca9ab
5
5
  SHA512:
6
- metadata.gz: 2b1773b88ec9589d880fd911035db3e77653ee812e71a9d06dbe3e6e9535cfdf24219f01282114a895c98bd367e32f3b82e1f1d7d44af322cc37596ee14636d4
7
- data.tar.gz: f360726ae0c9f1fb2e58b7fe161d3c118e82eb656fa4e11f17558ae29e4ff4042d2aa2190a9f7f6db69900c7f2b7834aa8caf4cd16785787fcc8b27c1f3d6cb0
6
+ metadata.gz: b76a6b7e6f0051fd6a9edcf15389da8131d7a2b89688219129817e34418e9ed88de42af7d428e027685d8e53f1da1b85356e3a96e1a2073e2fd07fe4caec3724
7
+ data.tar.gz: e1ae5adbf67d42896182efeae3944bf6ac8fbbe5192acd425083c725257b2203bcbe78748856ddd74a4de93b8eda95712218a10019af6084b2c94bbd3ce32bb1
data/.rubocop.yml CHANGED
@@ -3,7 +3,6 @@ require:
3
3
  - rubocop-rspec
4
4
  - rubocop-rails
5
5
  - rubocop-rake
6
- - rubocop-capybara
7
6
 
8
7
  AllCops:
9
8
  NewCops: enable
@@ -87,7 +86,6 @@ RSpec/ContextWording:
87
86
  Metrics/ModuleLength:
88
87
  Exclude:
89
88
  - 'spec/ccs/frontend_helpers/**/*'
90
- - 'spec/ccs/components/**/*'
91
89
 
92
90
  RSpec/MultipleMemoizedHelpers:
93
91
  Enabled: false
@@ -115,8 +113,7 @@ RSpec/NestedGroups:
115
113
 
116
114
  RSpec/ExampleLength:
117
115
  Exclude:
118
- - 'spec/ccs/frontend_helpers/**/*'
119
- - 'spec/ccs/components/**/*'
116
+ - 'spec/ccs/frontend_helpers/**/*'
120
117
 
121
118
  Rails/DynamicFindBy:
122
119
  Whitelist:
@@ -128,4 +125,3 @@ RSpec/MultipleExpectations:
128
125
  RSpec/FilePath:
129
126
  CustomTransform:
130
127
  GovUKFrontend: govuk_frontend
131
- GovUK: govuk
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.1.0.rc.7] - 2023-05-18
1
+ ## [0.1.0] - 2023-02-22
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.
@@ -19,9 +19,7 @@ The following GOV.UK helpers have been added:
19
19
  - Fieldset
20
20
  - File upload
21
21
  - Footer
22
- - Form group
23
22
  - Header
24
- - Hint
25
23
  - Inset text
26
24
  - Notification banner
27
25
  - Pagination
@@ -30,7 +28,6 @@ The following GOV.UK helpers have been added:
30
28
  - Radios
31
29
  - Select
32
30
  - Skip link
33
- - Step by step navigation
34
31
  - Summary list
35
32
  - Table
36
33
  - Tabs
@@ -42,5 +39,6 @@ The following GOV.UK helpers have been added:
42
39
  The following CCS helpers have been added:
43
40
 
44
41
  - Dashboard Panels
42
+ - Logo
45
43
  - Header
46
44
  - Footer
data/Gemfile CHANGED
@@ -5,20 +5,6 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in ccs-frontend_helpers.gemspec
6
6
  gemspec
7
7
 
8
- # Gems for building the package
9
- gem 'bundler', '~> 2.3'
10
8
  gem 'rake', '~> 13.0'
11
9
 
12
- # Gems for testing the package
13
- gem 'capybara', '~> 3.39.0'
14
- gem 'rspec', '~> 3.12'
15
- gem 'simplecov', '~> 0.21'
16
-
17
- # Gems for linting/formatting the package
18
- gem 'rubocop', '~> 1.36'
19
- gem 'rubocop-rails', '~> 2.16'
20
- gem 'rubocop-rake', '~> 0.6'
21
- gem 'rubocop-rspec', '~> 2.13'
22
-
23
- # Gems for documenting the package
24
- gem 'yard', '~> 0.9'
10
+ gem 'rspec', '~> 3.0'
data/Gemfile.lock CHANGED
@@ -1,82 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.0.rc.7)
4
+ ccs-frontend_helpers (0.1.0)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.4.3)
11
- actionpack (= 7.0.4.3)
12
- activesupport (= 7.0.4.3)
10
+ actioncable (7.0.4.2)
11
+ actionpack (= 7.0.4.2)
12
+ activesupport (= 7.0.4.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.4.3)
16
- actionpack (= 7.0.4.3)
17
- activejob (= 7.0.4.3)
18
- activerecord (= 7.0.4.3)
19
- activestorage (= 7.0.4.3)
20
- activesupport (= 7.0.4.3)
15
+ actionmailbox (7.0.4.2)
16
+ actionpack (= 7.0.4.2)
17
+ activejob (= 7.0.4.2)
18
+ activerecord (= 7.0.4.2)
19
+ activestorage (= 7.0.4.2)
20
+ activesupport (= 7.0.4.2)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.0.4.3)
26
- actionpack (= 7.0.4.3)
27
- actionview (= 7.0.4.3)
28
- activejob (= 7.0.4.3)
29
- activesupport (= 7.0.4.3)
25
+ actionmailer (7.0.4.2)
26
+ actionpack (= 7.0.4.2)
27
+ actionview (= 7.0.4.2)
28
+ activejob (= 7.0.4.2)
29
+ activesupport (= 7.0.4.2)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.0)
35
- actionpack (7.0.4.3)
36
- actionview (= 7.0.4.3)
37
- activesupport (= 7.0.4.3)
35
+ actionpack (7.0.4.2)
36
+ actionview (= 7.0.4.2)
37
+ activesupport (= 7.0.4.2)
38
38
  rack (~> 2.0, >= 2.2.0)
39
39
  rack-test (>= 0.6.3)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.4.3)
43
- actionpack (= 7.0.4.3)
44
- activerecord (= 7.0.4.3)
45
- activestorage (= 7.0.4.3)
46
- activesupport (= 7.0.4.3)
42
+ actiontext (7.0.4.2)
43
+ actionpack (= 7.0.4.2)
44
+ activerecord (= 7.0.4.2)
45
+ activestorage (= 7.0.4.2)
46
+ activesupport (= 7.0.4.2)
47
47
  globalid (>= 0.6.0)
48
48
  nokogiri (>= 1.8.5)
49
- actionview (7.0.4.3)
50
- activesupport (= 7.0.4.3)
49
+ actionview (7.0.4.2)
50
+ activesupport (= 7.0.4.2)
51
51
  builder (~> 3.1)
52
52
  erubi (~> 1.4)
53
53
  rails-dom-testing (~> 2.0)
54
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.4.3)
56
- activesupport (= 7.0.4.3)
55
+ activejob (7.0.4.2)
56
+ activesupport (= 7.0.4.2)
57
57
  globalid (>= 0.3.6)
58
- activemodel (7.0.4.3)
59
- activesupport (= 7.0.4.3)
60
- activerecord (7.0.4.3)
61
- activemodel (= 7.0.4.3)
62
- activesupport (= 7.0.4.3)
63
- activestorage (7.0.4.3)
64
- actionpack (= 7.0.4.3)
65
- activejob (= 7.0.4.3)
66
- activerecord (= 7.0.4.3)
67
- activesupport (= 7.0.4.3)
58
+ activemodel (7.0.4.2)
59
+ activesupport (= 7.0.4.2)
60
+ activerecord (7.0.4.2)
61
+ activemodel (= 7.0.4.2)
62
+ activesupport (= 7.0.4.2)
63
+ activestorage (7.0.4.2)
64
+ actionpack (= 7.0.4.2)
65
+ activejob (= 7.0.4.2)
66
+ activerecord (= 7.0.4.2)
67
+ activesupport (= 7.0.4.2)
68
68
  marcel (~> 1.0)
69
69
  mini_mime (>= 1.1.0)
70
- activesupport (7.0.4.3)
70
+ activesupport (7.0.4.2)
71
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
74
74
  tzinfo (~> 2.0)
75
- addressable (2.8.4)
75
+ addressable (2.8.1)
76
76
  public_suffix (>= 2.0.2, < 6.0)
77
77
  ast (2.4.2)
78
78
  builder (3.2.4)
79
- capybara (3.39.1)
79
+ capybara (3.38.0)
80
80
  addressable
81
81
  matrix
82
82
  mini_mime (>= 0.1.3)
@@ -85,7 +85,7 @@ GEM
85
85
  rack-test (>= 0.6.3)
86
86
  regexp_parser (>= 1.5, < 3.0)
87
87
  xpath (~> 3.2)
88
- concurrent-ruby (1.2.2)
88
+ concurrent-ruby (1.2.0)
89
89
  crass (1.0.6)
90
90
  date (3.3.3)
91
91
  diff-lcs (1.5.0)
@@ -108,7 +108,7 @@ GEM
108
108
  matrix (0.4.2)
109
109
  method_source (1.0.0)
110
110
  mini_mime (1.1.2)
111
- minitest (5.18.0)
111
+ minitest (5.17.0)
112
112
  net-imap (0.3.4)
113
113
  date
114
114
  net-protocol
@@ -119,47 +119,47 @@ GEM
119
119
  net-smtp (0.3.3)
120
120
  net-protocol
121
121
  nio4r (2.5.8)
122
- nokogiri (1.14.4-x86_64-darwin)
122
+ nokogiri (1.14.1-x86_64-darwin)
123
123
  racc (~> 1.4)
124
- nokogiri (1.14.4-x86_64-linux)
124
+ nokogiri (1.14.1-x86_64-linux)
125
125
  racc (~> 1.4)
126
- parallel (1.23.0)
127
- parser (3.2.2.1)
126
+ parallel (1.22.1)
127
+ parser (3.2.1.0)
128
128
  ast (~> 2.4.1)
129
129
  public_suffix (5.0.1)
130
130
  racc (1.6.2)
131
- rack (2.2.7)
132
- rack-test (2.1.0)
131
+ rack (2.2.6.2)
132
+ rack-test (2.0.2)
133
133
  rack (>= 1.3)
134
- rails (7.0.4.3)
135
- actioncable (= 7.0.4.3)
136
- actionmailbox (= 7.0.4.3)
137
- actionmailer (= 7.0.4.3)
138
- actionpack (= 7.0.4.3)
139
- actiontext (= 7.0.4.3)
140
- actionview (= 7.0.4.3)
141
- activejob (= 7.0.4.3)
142
- activemodel (= 7.0.4.3)
143
- activerecord (= 7.0.4.3)
144
- activestorage (= 7.0.4.3)
145
- activesupport (= 7.0.4.3)
134
+ rails (7.0.4.2)
135
+ actioncable (= 7.0.4.2)
136
+ actionmailbox (= 7.0.4.2)
137
+ actionmailer (= 7.0.4.2)
138
+ actionpack (= 7.0.4.2)
139
+ actiontext (= 7.0.4.2)
140
+ actionview (= 7.0.4.2)
141
+ activejob (= 7.0.4.2)
142
+ activemodel (= 7.0.4.2)
143
+ activerecord (= 7.0.4.2)
144
+ activestorage (= 7.0.4.2)
145
+ activesupport (= 7.0.4.2)
146
146
  bundler (>= 1.15.0)
147
- railties (= 7.0.4.3)
147
+ railties (= 7.0.4.2)
148
148
  rails-dom-testing (2.0.3)
149
149
  activesupport (>= 4.2.0)
150
150
  nokogiri (>= 1.6)
151
151
  rails-html-sanitizer (1.5.0)
152
152
  loofah (~> 2.19, >= 2.19.1)
153
- railties (7.0.4.3)
154
- actionpack (= 7.0.4.3)
155
- activesupport (= 7.0.4.3)
153
+ railties (7.0.4.2)
154
+ actionpack (= 7.0.4.2)
155
+ activesupport (= 7.0.4.2)
156
156
  method_source
157
157
  rake (>= 12.2)
158
158
  thor (~> 1.0)
159
159
  zeitwerk (~> 2.5)
160
160
  rainbow (3.1.1)
161
161
  rake (13.0.6)
162
- regexp_parser (2.8.0)
162
+ regexp_parser (2.7.0)
163
163
  rexml (3.2.5)
164
164
  rspec (3.12.0)
165
165
  rspec-core (~> 3.12.0)
@@ -174,33 +174,30 @@ GEM
174
174
  diff-lcs (>= 1.2.0, < 2.0)
175
175
  rspec-support (~> 3.12.0)
176
176
  rspec-support (3.12.0)
177
- rubocop (1.51.0)
177
+ rubocop (1.45.1)
178
178
  json (~> 2.3)
179
179
  parallel (~> 1.10)
180
180
  parser (>= 3.2.0.0)
181
181
  rainbow (>= 2.2.2, < 4.0)
182
182
  regexp_parser (>= 1.8, < 3.0)
183
183
  rexml (>= 3.2.5, < 4.0)
184
- rubocop-ast (>= 1.28.0, < 2.0)
184
+ rubocop-ast (>= 1.24.1, < 2.0)
185
185
  ruby-progressbar (~> 1.7)
186
186
  unicode-display_width (>= 2.4.0, < 3.0)
187
- rubocop-ast (1.28.1)
187
+ rubocop-ast (1.26.0)
188
188
  parser (>= 3.2.1.0)
189
- rubocop-capybara (2.18.0)
189
+ rubocop-capybara (2.17.0)
190
190
  rubocop (~> 1.41)
191
- rubocop-factory_bot (2.22.0)
192
- rubocop (~> 1.33)
193
- rubocop-rails (2.19.1)
191
+ rubocop-rails (2.17.4)
194
192
  activesupport (>= 4.2.0)
195
193
  rack (>= 1.1)
196
194
  rubocop (>= 1.33.0, < 2.0)
197
195
  rubocop-rake (0.6.0)
198
196
  rubocop (~> 1.0)
199
- rubocop-rspec (2.22.0)
197
+ rubocop-rspec (2.18.1)
200
198
  rubocop (~> 1.33)
201
199
  rubocop-capybara (~> 2.17)
202
- rubocop-factory_bot (~> 2.22)
203
- ruby-progressbar (1.13.0)
200
+ ruby-progressbar (1.11.0)
204
201
  simplecov (0.22.0)
205
202
  docile (~> 1.1)
206
203
  simplecov-html (~> 0.11)
@@ -208,17 +205,19 @@ GEM
208
205
  simplecov-html (0.12.3)
209
206
  simplecov_json_formatter (0.1.4)
210
207
  thor (1.2.1)
211
- timeout (0.3.2)
208
+ timeout (0.3.1)
212
209
  tzinfo (2.0.6)
213
210
  concurrent-ruby (~> 1.0)
214
211
  unicode-display_width (2.4.2)
212
+ webrick (1.7.0)
215
213
  websocket-driver (0.7.5)
216
214
  websocket-extensions (>= 0.1.0)
217
215
  websocket-extensions (0.1.5)
218
216
  xpath (3.2.0)
219
217
  nokogiri (~> 1.8)
220
- yard (0.9.34)
221
- zeitwerk (2.6.7)
218
+ yard (0.9.28)
219
+ webrick (~> 1.7.0)
220
+ zeitwerk (2.6.6)
222
221
 
223
222
  PLATFORMS
224
223
  x86_64-darwin-19
@@ -227,10 +226,10 @@ PLATFORMS
227
226
 
228
227
  DEPENDENCIES
229
228
  bundler (~> 2.3)
230
- capybara (~> 3.39.0)
229
+ capybara (~> 3.38.0)
231
230
  ccs-frontend_helpers!
232
231
  rake (~> 13.0)
233
- rspec (~> 3.12)
232
+ rspec (~> 3.0)
234
233
  rubocop (~> 1.36)
235
234
  rubocop-rails (~> 2.16)
236
235
  rubocop-rake (~> 0.6)
@@ -239,4 +238,4 @@ DEPENDENCIES
239
238
  yard (~> 0.9)
240
239
 
241
240
  BUNDLED WITH
242
- 2.3.24
241
+ 2.3.12
@@ -33,5 +33,15 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_dependency 'rails', '>= 6.0'
35
35
 
36
+ spec.add_development_dependency 'bundler', '~> 2.3'
37
+ spec.add_development_dependency 'capybara', '~> 3.38.0'
38
+ spec.add_development_dependency 'rspec', '~> 3.12'
39
+ spec.add_development_dependency 'rubocop', '~> 1.36'
40
+ spec.add_development_dependency 'rubocop-rails', '~> 2.16'
41
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
42
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.13'
43
+ spec.add_development_dependency 'simplecov', '~> 0.21'
44
+ spec.add_development_dependency 'yard', '~> 0.9'
45
+
36
46
  spec.metadata['rubygems_mfa_required'] = 'true'
37
47
  end
@@ -0,0 +1,79 @@
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 CCSFrontend
10
+ # = CCS Dashboard Panels
11
+ #
12
+ # This helper is used for generating the dashboard panels component
13
+
14
+ module DashboardPanels
15
+ include SharedMethods
16
+ include ActionView::Context
17
+ include ActionView::Helpers::TagHelper
18
+ include ActionView::Helpers::TextHelper
19
+ include ActionView::Helpers::UrlHelper
20
+
21
+ # Generates the HTML for the CCS Dashboard Panels component
22
+ #
23
+ # @param panel_items [Array] the panel items, see {ccs_dashboard_panels_item}
24
+ # @param title_text [String] text for the title of a dashboard panels section
25
+ # @param ccs_dashboard_panels_options [Hash] options that will be used in customising the HTML
26
+ #
27
+ # @option ccs_dashboard_panels_options [String] :classes additional CSS classes for the dashboard panels HTML
28
+ # @option ccs_dashboard_panels_options [String] :width (default: 'full') the width of the dashbaord panel section
29
+ # @option ccs_dashboard_panels_options [Hash] :attributes additional attributes that will added as part of the HTML
30
+ #
31
+ # @return [ActiveSupport::SafeBuffer] the HTML for the CCS Dashboard Panels
32
+ # which can then be rendered on the page
33
+
34
+ def ccs_dashboard_panels(panel_items, title_text = nil, **ccs_dashboard_panels_options)
35
+ initialise_attributes_and_set_classes(ccs_dashboard_panels_options, 'ccs-dashboard-panels')
36
+
37
+ tag.div(**ccs_dashboard_panels_options[:attributes]) do
38
+ tag.div(class: 'govuk-grid-row') do
39
+ tag.div(class: "govuk-grid-column-#{ccs_dashboard_panels_options[:width] || 'full'}") do
40
+ if title_text
41
+ concat(tag.h2(title_text, class: 'ccs-dashboard-panels__heading govuk-heading-m'))
42
+ concat(tag.hr(class: 'ccs-dashboard-panels__heading-section-break govuk-section-break govuk-section-break--visible'))
43
+ end
44
+ concat(tag.div(class: 'ccs-dashboard-panels__container') do
45
+ tag.div(class: 'govuk-grid-row') do
46
+ panel_items.each { |panel_item| concat(ccs_dashboard_panels_item(panel_item)) }
47
+ end
48
+ end)
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ # Generates the HTML for the a dashboard panel item in {ccs_dashboard_panels}
57
+ #
58
+ # @param panel_item [Hash] options for the dashboard panel item
59
+ #
60
+ # @option panel_item [String] :title the title for the dashboard panel
61
+ # @option panel_item [String] :href the href for the dashboard panel
62
+ # @option panel_item [String] :description the description text for the dashboard panel
63
+ # @option panel_item [String] :width (default: 'one-third') the width of the dashboard panel item
64
+ # @option panel_item [Hash] :attributes additional attributes that will added as part of the HTML
65
+ #
66
+ # @return [ActiveSupport::SafeBuffer] the HTML for a panel item in {ccs_dashboard_panels}
67
+
68
+ def ccs_dashboard_panels_item(panel_item)
69
+ (panel_item[:attributes] ||= {})[:class] = "ccs-dashboard-panels__item govuk-grid-column-#{panel_item[:width] || 'one-third'}"
70
+
71
+ tag.div(**panel_item[:attributes]) do
72
+ concat(link_to(panel_item[:title], panel_item[:href], class: 'ccs-dashboard-panels__item-title'))
73
+ concat(tag.p(panel_item[:description], class: 'ccs-dashboard-panels__item-description'))
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../components/ccs/footer'
3
+ require_relative 'logo'
4
+ require_relative '../shared_methods'
4
5
 
5
6
  module CCS
6
7
  module FrontendHelpers
@@ -11,16 +12,128 @@ module CCS
11
12
  # {https://github.com/tim-s-ccs/ts-ccs-frontend/tree/main/src/ccs/components/footer CCS - Components - Footer}
12
13
 
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
+
14
22
  # Generates the HTML for the CCS Footer component
15
23
  #
16
- # @param (see CCS::Components::CCS::Footer#initialize)
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}
17
128
  #
18
- # @option (see CCS::Components::CCS::Footer#initialize)
129
+ # @param copyright [ActiveSupport::SafeBuffer,String] the copyright information, this defaults to Crown Copyright
19
130
  #
20
- # @return (see CCS::Components::CCS::Footer#render)
131
+ # @return [ActiveSupport::SafeBuffer] the HTML for the copyright used in {ccs_footer}
21
132
 
22
- def ccs_footer(**options)
23
- Components::CCS::Footer.new(context: self, **options).render
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
24
137
  end
25
138
  end
26
139
  end