ccs-frontend_helpers 0.1.0 → 0.1.1.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -2
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +4 -1
  5. data/Gemfile +15 -1
  6. data/Gemfile.lock +153 -114
  7. data/ccs-frontend_helpers.gemspec +1 -11
  8. data/lib/ccs/components/base.rb +64 -0
  9. data/lib/ccs/components/ccs/dashboard_section/panel.rb +57 -0
  10. data/lib/ccs/components/ccs/dashboard_section.rb +71 -0
  11. data/lib/ccs/components/ccs/footer/link.rb +55 -0
  12. data/lib/ccs/components/ccs/footer/meta.rb +59 -0
  13. data/lib/ccs/components/ccs/footer/navigation.rb +60 -0
  14. data/lib/ccs/components/ccs/footer.rb +95 -0
  15. data/lib/ccs/components/ccs/header/link.rb +60 -0
  16. data/lib/ccs/components/ccs/header/navigation.rb +98 -0
  17. data/lib/ccs/components/ccs/header/service_authentication.rb +53 -0
  18. data/lib/ccs/components/ccs/header.rb +110 -0
  19. data/lib/ccs/{frontend_helpers/ccs_frontend → components/ccs}/logo.rb +10 -12
  20. data/lib/ccs/components/govuk/accordion/section/content.rb +53 -0
  21. data/lib/ccs/components/govuk/accordion/section/header.rb +57 -0
  22. data/lib/ccs/components/govuk/accordion/section.rb +61 -0
  23. data/lib/ccs/components/govuk/accordion.rb +58 -0
  24. data/lib/ccs/components/govuk/back_link.rb +51 -0
  25. data/lib/ccs/components/govuk/breadcrumbs/link.rb +57 -0
  26. data/lib/ccs/components/govuk/breadcrumbs.rb +55 -0
  27. data/lib/ccs/components/govuk/button.rb +107 -0
  28. data/lib/ccs/components/govuk/cookie_banner/action.rb +60 -0
  29. data/lib/ccs/components/govuk/cookie_banner/message.rb +80 -0
  30. data/lib/ccs/components/govuk/cookie_banner.rb +55 -0
  31. data/lib/ccs/components/govuk/details.rb +53 -0
  32. data/lib/ccs/components/govuk/error_message.rb +60 -0
  33. data/lib/ccs/components/govuk/error_summary/item.rb +54 -0
  34. data/lib/ccs/components/govuk/error_summary.rb +70 -0
  35. data/lib/ccs/components/govuk/field/input/character_count.rb +129 -0
  36. data/lib/ccs/components/govuk/field/input/file_upload.rb +44 -0
  37. data/lib/ccs/components/govuk/field/input/select.rb +82 -0
  38. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +55 -0
  39. data/lib/ccs/components/govuk/field/input/text_input.rb +97 -0
  40. data/lib/ccs/components/govuk/field/input/textarea.rb +59 -0
  41. data/lib/ccs/components/govuk/field/input.rb +62 -0
  42. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +69 -0
  43. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +65 -0
  44. data/lib/ccs/components/govuk/field/inputs/date_input.rb +89 -0
  45. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +47 -0
  46. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +43 -0
  47. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +50 -0
  48. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +50 -0
  49. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +44 -0
  50. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +43 -0
  51. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +50 -0
  52. data/lib/ccs/components/govuk/field/inputs/item.rb +111 -0
  53. data/lib/ccs/components/govuk/field/inputs/radios.rb +69 -0
  54. data/lib/ccs/components/govuk/field/inputs.rb +57 -0
  55. data/lib/ccs/components/govuk/field.rb +108 -0
  56. data/lib/ccs/components/govuk/fieldset/legend.rb +65 -0
  57. data/lib/ccs/components/govuk/fieldset.rb +54 -0
  58. data/lib/ccs/components/govuk/footer/link.rb +55 -0
  59. data/lib/ccs/components/govuk/footer/meta.rb +59 -0
  60. data/lib/ccs/components/govuk/footer/navigation.rb +60 -0
  61. data/lib/ccs/components/govuk/footer.rb +131 -0
  62. data/lib/ccs/components/govuk/form_group.rb +60 -0
  63. data/lib/ccs/components/govuk/header/link.rb +56 -0
  64. data/lib/ccs/components/govuk/header/navigation.rb +71 -0
  65. data/lib/ccs/components/govuk/header.rb +107 -0
  66. data/lib/ccs/components/govuk/hint.rb +49 -0
  67. data/lib/ccs/components/govuk/inset_text.rb +52 -0
  68. data/lib/ccs/components/govuk/label.rb +85 -0
  69. data/lib/ccs/components/govuk/notification_banner.rb +107 -0
  70. data/lib/ccs/components/govuk/pagination/increment/next.rb +44 -0
  71. data/lib/ccs/components/govuk/pagination/increment/previous.rb +43 -0
  72. data/lib/ccs/components/govuk/pagination/increment.rb +98 -0
  73. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +28 -0
  74. data/lib/ccs/components/govuk/pagination/item/form.rb +49 -0
  75. data/lib/ccs/components/govuk/pagination/item/tag.rb +47 -0
  76. data/lib/ccs/components/govuk/pagination/item.rb +64 -0
  77. data/lib/ccs/components/govuk/pagination.rb +96 -0
  78. data/lib/ccs/components/govuk/panel.rb +62 -0
  79. data/lib/ccs/components/govuk/phase_banner.rb +69 -0
  80. data/lib/ccs/components/govuk/skip_link.rb +51 -0
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +53 -0
  82. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +50 -0
  83. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +45 -0
  84. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +63 -0
  85. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +69 -0
  86. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +56 -0
  87. data/lib/ccs/components/govuk/step_by_step_navigation.rb +59 -0
  88. data/lib/ccs/components/govuk/summary_list/action/link.rb +59 -0
  89. data/lib/ccs/components/govuk/summary_list/card/actions.rb +59 -0
  90. data/lib/ccs/components/govuk/summary_list/card/title.rb +51 -0
  91. data/lib/ccs/components/govuk/summary_list/card.rb +63 -0
  92. data/lib/ccs/components/govuk/summary_list/row/actions.rb +59 -0
  93. data/lib/ccs/components/govuk/summary_list/row/key.rb +47 -0
  94. data/lib/ccs/components/govuk/summary_list/row/value.rb +47 -0
  95. data/lib/ccs/components/govuk/summary_list/row.rb +67 -0
  96. data/lib/ccs/components/govuk/summary_list.rb +74 -0
  97. data/lib/ccs/components/govuk/table/body/data_cell.rb +53 -0
  98. data/lib/ccs/components/govuk/table/body/head_cell.rb +52 -0
  99. data/lib/ccs/components/govuk/table/header/head_cell.rb +54 -0
  100. data/lib/ccs/components/govuk/table.rb +111 -0
  101. data/lib/ccs/components/govuk/tabs/panel.rb +58 -0
  102. data/lib/ccs/components/govuk/tabs/tab.rb +56 -0
  103. data/lib/ccs/components/govuk/tabs.rb +66 -0
  104. data/lib/ccs/components/govuk/tag.rb +51 -0
  105. data/lib/ccs/components/govuk/warning_text.rb +61 -0
  106. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +27 -0
  107. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +6 -119
  108. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +6 -183
  109. data/lib/ccs/frontend_helpers/ccs_frontend.rb +2 -4
  110. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +8 -95
  111. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +6 -17
  112. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +6 -54
  113. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +6 -105
  114. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +28 -0
  115. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +28 -0
  116. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +6 -114
  117. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +28 -0
  118. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +7 -23
  119. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +11 -32
  120. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +13 -65
  121. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +7 -48
  122. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +28 -0
  123. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +6 -161
  124. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +13 -24
  125. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +6 -139
  126. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +8 -17
  127. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +28 -0
  128. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +7 -21
  129. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +7 -70
  130. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +7 -113
  131. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +6 -314
  132. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +7 -28
  133. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +8 -27
  134. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +28 -0
  135. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +28 -0
  136. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +6 -18
  137. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +7 -186
  138. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +6 -204
  139. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +11 -100
  140. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +6 -73
  141. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +7 -21
  142. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +28 -0
  143. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +7 -30
  144. data/lib/ccs/frontend_helpers/govuk_frontend.rb +17 -19
  145. data/lib/ccs/frontend_helpers/version.rb +1 -1
  146. metadata +117 -147
  147. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_panels.rb +0 -79
  148. data/lib/ccs/frontend_helpers/govuk_frontend/field/character_count.rb +0 -165
  149. data/lib/ccs/frontend_helpers/govuk_frontend/field/checkboxes.rb +0 -200
  150. data/lib/ccs/frontend_helpers/govuk_frontend/field/date_input.rb +0 -153
  151. data/lib/ccs/frontend_helpers/govuk_frontend/field/file_upload.rb +0 -83
  152. data/lib/ccs/frontend_helpers/govuk_frontend/field/input.rb +0 -153
  153. data/lib/ccs/frontend_helpers/govuk_frontend/field/radios.rb +0 -201
  154. data/lib/ccs/frontend_helpers/govuk_frontend/field/select.rb +0 -124
  155. data/lib/ccs/frontend_helpers/govuk_frontend/field/textarea.rb +0 -106
  156. data/lib/ccs/frontend_helpers/govuk_frontend/field.rb +0 -213
  157. data/lib/ccs/frontend_helpers/shared_methods.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5a550b15fe6ba2415299994f716d842c129687e2c5fe8e124fbbf09332913d7
4
- data.tar.gz: a9be14a1105948400e4445694e339981b9a1e51cdb9d9c8111a01f2f35dca9ab
3
+ metadata.gz: 47cea0efab0b2b500e61c298c3930110edfc8987433b014d6082094879fcb78e
4
+ data.tar.gz: 3a27eba61118d1fb93527a5974625aafbd8ce48b1afd0129739b83945006e0eb
5
5
  SHA512:
6
- metadata.gz: b76a6b7e6f0051fd6a9edcf15389da8131d7a2b89688219129817e34418e9ed88de42af7d428e027685d8e53f1da1b85356e3a96e1a2073e2fd07fe4caec3724
7
- data.tar.gz: e1ae5adbf67d42896182efeae3944bf6ac8fbbe5192acd425083c725257b2203bcbe78748856ddd74a4de93b8eda95712218a10019af6084b2c94bbd3ce32bb1
6
+ metadata.gz: beb74c7841592955c2e009db103968abf0c3a24c8fa374de5fcf972678f65df466b1be4a0d76ba04625302ecae99ca2e5ef46d10583f8220517529102574c783
7
+ data.tar.gz: 29d451b4b057b3387e82fd7db170f5f4450aeac37afeab81059593b0162a1e5834b40af79cb2cb131283d0f507a9111ff1c21e25d367ef6262745df44acad9b3
data/.rubocop.yml CHANGED
@@ -3,10 +3,11 @@ require:
3
3
  - rubocop-rspec
4
4
  - rubocop-rails
5
5
  - rubocop-rake
6
+ - rubocop-capybara
6
7
 
7
8
  AllCops:
8
9
  NewCops: enable
9
- TargetRubyVersion: 2.7
10
+ TargetRubyVersion: 3.0
10
11
  Exclude:
11
12
  - 'bin/**/*'
12
13
  - 'tmp/**/*'
@@ -86,6 +87,7 @@ RSpec/ContextWording:
86
87
  Metrics/ModuleLength:
87
88
  Exclude:
88
89
  - 'spec/ccs/frontend_helpers/**/*'
90
+ - 'spec/ccs/components/**/*'
89
91
 
90
92
  RSpec/MultipleMemoizedHelpers:
91
93
  Enabled: false
@@ -113,7 +115,8 @@ RSpec/NestedGroups:
113
115
 
114
116
  RSpec/ExampleLength:
115
117
  Exclude:
116
- - 'spec/ccs/frontend_helpers/**/*'
118
+ - 'spec/ccs/frontend_helpers/**/*'
119
+ - 'spec/ccs/components/**/*'
117
120
 
118
121
  Rails/DynamicFindBy:
119
122
  Whitelist:
@@ -125,3 +128,9 @@ RSpec/MultipleExpectations:
125
128
  RSpec/FilePath:
126
129
  CustomTransform:
127
130
  GovUKFrontend: govuk_frontend
131
+ GovUK: govuk
132
+
133
+ RSpec/SpecFilePathFormat:
134
+ CustomTransform:
135
+ GovUKFrontend: govuk_frontend
136
+ GovUK: govuk
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.1.0] - 2023-02-22
1
+ ## [0.1.1.rc.1] - 2023-10-25
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,7 +19,9 @@ The following GOV.UK helpers have been added:
19
19
  - Fieldset
20
20
  - File upload
21
21
  - Footer
22
+ - Form group
22
23
  - Header
24
+ - Hint
23
25
  - Inset text
24
26
  - Notification banner
25
27
  - Pagination
@@ -28,6 +30,7 @@ The following GOV.UK helpers have been added:
28
30
  - Radios
29
31
  - Select
30
32
  - Skip link
33
+ - Step by step navigation
31
34
  - Summary list
32
35
  - Table
33
36
  - Tabs
data/Gemfile CHANGED
@@ -5,6 +5,20 @@ 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'
8
10
  gem 'rake', '~> 13.0'
9
11
 
10
- gem 'rspec', '~> 3.0'
12
+ # Gems for testing the package
13
+ gem 'capybara', '~> 3.39.2'
14
+ gem 'rspec', '~> 3.12'
15
+ gem 'simplecov', '~> 0.21'
16
+
17
+ # Gems for linting/formatting the package
18
+ gem 'rubocop', '~> 1.57'
19
+ gem 'rubocop-rails', '~> 2.21'
20
+ gem 'rubocop-rake', '~> 0.6'
21
+ gem 'rubocop-rspec', '~> 2.24'
22
+
23
+ # Gems for documenting the package
24
+ gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,82 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.0)
4
+ ccs-frontend_helpers (0.1.1.rc.1)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.4.2)
11
- actionpack (= 7.0.4.2)
12
- activesupport (= 7.0.4.2)
10
+ actioncable (7.1.1)
11
+ actionpack (= 7.1.1)
12
+ activesupport (= 7.1.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
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)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.1)
17
+ actionpack (= 7.1.1)
18
+ activejob (= 7.1.1)
19
+ activerecord (= 7.1.1)
20
+ activestorage (= 7.1.1)
21
+ activesupport (= 7.1.1)
21
22
  mail (>= 2.7.1)
22
23
  net-imap
23
24
  net-pop
24
25
  net-smtp
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)
26
+ actionmailer (7.1.1)
27
+ actionpack (= 7.1.1)
28
+ actionview (= 7.1.1)
29
+ activejob (= 7.1.1)
30
+ activesupport (= 7.1.1)
30
31
  mail (~> 2.5, >= 2.5.4)
31
32
  net-imap
32
33
  net-pop
33
34
  net-smtp
34
- rails-dom-testing (~> 2.0)
35
- actionpack (7.0.4.2)
36
- actionview (= 7.0.4.2)
37
- activesupport (= 7.0.4.2)
38
- rack (~> 2.0, >= 2.2.0)
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.1)
37
+ actionview (= 7.1.1)
38
+ activesupport (= 7.1.1)
39
+ nokogiri (>= 1.8.5)
40
+ rack (>= 2.2.4)
41
+ rack-session (>= 1.0.1)
39
42
  rack-test (>= 0.6.3)
40
- rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
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)
43
+ rails-dom-testing (~> 2.2)
44
+ rails-html-sanitizer (~> 1.6)
45
+ actiontext (7.1.1)
46
+ actionpack (= 7.1.1)
47
+ activerecord (= 7.1.1)
48
+ activestorage (= 7.1.1)
49
+ activesupport (= 7.1.1)
47
50
  globalid (>= 0.6.0)
48
51
  nokogiri (>= 1.8.5)
49
- actionview (7.0.4.2)
50
- activesupport (= 7.0.4.2)
52
+ actionview (7.1.1)
53
+ activesupport (= 7.1.1)
51
54
  builder (~> 3.1)
52
- erubi (~> 1.4)
53
- rails-dom-testing (~> 2.0)
54
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.4.2)
56
- activesupport (= 7.0.4.2)
55
+ erubi (~> 1.11)
56
+ rails-dom-testing (~> 2.2)
57
+ rails-html-sanitizer (~> 1.6)
58
+ activejob (7.1.1)
59
+ activesupport (= 7.1.1)
57
60
  globalid (>= 0.3.6)
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)
61
+ activemodel (7.1.1)
62
+ activesupport (= 7.1.1)
63
+ activerecord (7.1.1)
64
+ activemodel (= 7.1.1)
65
+ activesupport (= 7.1.1)
66
+ timeout (>= 0.4.0)
67
+ activestorage (7.1.1)
68
+ actionpack (= 7.1.1)
69
+ activejob (= 7.1.1)
70
+ activerecord (= 7.1.1)
71
+ activesupport (= 7.1.1)
68
72
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.4.2)
73
+ activesupport (7.1.1)
74
+ base64
75
+ bigdecimal
71
76
  concurrent-ruby (~> 1.0, >= 1.0.2)
77
+ connection_pool (>= 2.2.5)
78
+ drb
72
79
  i18n (>= 1.6, < 2)
73
80
  minitest (>= 5.1)
81
+ mutex_m
74
82
  tzinfo (~> 2.0)
75
- addressable (2.8.1)
83
+ addressable (2.8.4)
76
84
  public_suffix (>= 2.0.2, < 6.0)
77
85
  ast (2.4.2)
86
+ base64 (0.1.1)
87
+ bigdecimal (3.1.4)
78
88
  builder (3.2.4)
79
- capybara (3.38.0)
89
+ capybara (3.39.2)
80
90
  addressable
81
91
  matrix
82
92
  mini_mime (>= 0.1.3)
@@ -85,20 +95,28 @@ GEM
85
95
  rack-test (>= 0.6.3)
86
96
  regexp_parser (>= 1.5, < 3.0)
87
97
  xpath (~> 3.2)
88
- concurrent-ruby (1.2.0)
98
+ concurrent-ruby (1.2.2)
99
+ connection_pool (2.4.1)
89
100
  crass (1.0.6)
90
101
  date (3.3.3)
91
102
  diff-lcs (1.5.0)
92
103
  docile (1.4.0)
104
+ drb (2.1.1)
105
+ ruby2_keywords
93
106
  erubi (1.12.0)
94
- globalid (1.1.0)
95
- activesupport (>= 5.0)
96
- i18n (1.12.0)
107
+ globalid (1.2.1)
108
+ activesupport (>= 6.1)
109
+ i18n (1.14.1)
97
110
  concurrent-ruby (~> 1.0)
111
+ io-console (0.6.0)
112
+ irb (1.8.3)
113
+ rdoc
114
+ reline (>= 0.3.8)
98
115
  json (2.6.3)
99
- loofah (2.19.1)
116
+ language_server-protocol (3.17.0.3)
117
+ loofah (2.21.4)
100
118
  crass (~> 1.0.2)
101
- nokogiri (>= 1.5.9)
119
+ nokogiri (>= 1.12.0)
102
120
  mail (2.8.1)
103
121
  mini_mime (>= 0.1.1)
104
122
  net-imap
@@ -106,61 +124,76 @@ GEM
106
124
  net-smtp
107
125
  marcel (1.0.2)
108
126
  matrix (0.4.2)
109
- method_source (1.0.0)
110
- mini_mime (1.1.2)
111
- minitest (5.17.0)
112
- net-imap (0.3.4)
127
+ mini_mime (1.1.5)
128
+ minitest (5.20.0)
129
+ mutex_m (0.1.2)
130
+ net-imap (0.4.2)
113
131
  date
114
132
  net-protocol
115
133
  net-pop (0.1.2)
116
134
  net-protocol
117
135
  net-protocol (0.2.1)
118
136
  timeout
119
- net-smtp (0.3.3)
137
+ net-smtp (0.4.0)
120
138
  net-protocol
121
- nio4r (2.5.8)
122
- nokogiri (1.14.1-x86_64-darwin)
139
+ nio4r (2.5.9)
140
+ nokogiri (1.15.4-x86_64-darwin)
123
141
  racc (~> 1.4)
124
- nokogiri (1.14.1-x86_64-linux)
142
+ nokogiri (1.15.4-x86_64-linux)
125
143
  racc (~> 1.4)
126
- parallel (1.22.1)
127
- parser (3.2.1.0)
144
+ parallel (1.23.0)
145
+ parser (3.2.2.4)
128
146
  ast (~> 2.4.1)
147
+ racc
148
+ psych (5.1.1.1)
149
+ stringio
129
150
  public_suffix (5.0.1)
130
- racc (1.6.2)
131
- rack (2.2.6.2)
132
- rack-test (2.0.2)
151
+ racc (1.7.1)
152
+ rack (3.0.8)
153
+ rack-session (2.0.0)
154
+ rack (>= 3.0.0)
155
+ rack-test (2.1.0)
133
156
  rack (>= 1.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)
157
+ rackup (2.1.0)
158
+ rack (>= 3)
159
+ webrick (~> 1.8)
160
+ rails (7.1.1)
161
+ actioncable (= 7.1.1)
162
+ actionmailbox (= 7.1.1)
163
+ actionmailer (= 7.1.1)
164
+ actionpack (= 7.1.1)
165
+ actiontext (= 7.1.1)
166
+ actionview (= 7.1.1)
167
+ activejob (= 7.1.1)
168
+ activemodel (= 7.1.1)
169
+ activerecord (= 7.1.1)
170
+ activestorage (= 7.1.1)
171
+ activesupport (= 7.1.1)
146
172
  bundler (>= 1.15.0)
147
- railties (= 7.0.4.2)
148
- rails-dom-testing (2.0.3)
149
- activesupport (>= 4.2.0)
173
+ railties (= 7.1.1)
174
+ rails-dom-testing (2.2.0)
175
+ activesupport (>= 5.0.0)
176
+ minitest
150
177
  nokogiri (>= 1.6)
151
- rails-html-sanitizer (1.5.0)
152
- loofah (~> 2.19, >= 2.19.1)
153
- railties (7.0.4.2)
154
- actionpack (= 7.0.4.2)
155
- activesupport (= 7.0.4.2)
156
- method_source
178
+ rails-html-sanitizer (1.6.0)
179
+ loofah (~> 2.21)
180
+ nokogiri (~> 1.14)
181
+ railties (7.1.1)
182
+ actionpack (= 7.1.1)
183
+ activesupport (= 7.1.1)
184
+ irb
185
+ rackup (>= 1.0.0)
157
186
  rake (>= 12.2)
158
- thor (~> 1.0)
159
- zeitwerk (~> 2.5)
187
+ thor (~> 1.0, >= 1.2.2)
188
+ zeitwerk (~> 2.6)
160
189
  rainbow (3.1.1)
161
190
  rake (13.0.6)
162
- regexp_parser (2.7.0)
163
- rexml (3.2.5)
191
+ rdoc (6.5.0)
192
+ psych (>= 4.0.0)
193
+ regexp_parser (2.8.2)
194
+ reline (0.3.9)
195
+ io-console (~> 0.5)
196
+ rexml (3.2.6)
164
197
  rspec (3.12.0)
165
198
  rspec-core (~> 3.12.0)
166
199
  rspec-expectations (~> 3.12.0)
@@ -174,50 +207,56 @@ GEM
174
207
  diff-lcs (>= 1.2.0, < 2.0)
175
208
  rspec-support (~> 3.12.0)
176
209
  rspec-support (3.12.0)
177
- rubocop (1.45.1)
210
+ rubocop (1.57.1)
211
+ base64 (~> 0.1.1)
178
212
  json (~> 2.3)
213
+ language_server-protocol (>= 3.17.0)
179
214
  parallel (~> 1.10)
180
- parser (>= 3.2.0.0)
215
+ parser (>= 3.2.2.4)
181
216
  rainbow (>= 2.2.2, < 4.0)
182
217
  regexp_parser (>= 1.8, < 3.0)
183
218
  rexml (>= 3.2.5, < 4.0)
184
- rubocop-ast (>= 1.24.1, < 2.0)
219
+ rubocop-ast (>= 1.28.1, < 2.0)
185
220
  ruby-progressbar (~> 1.7)
186
221
  unicode-display_width (>= 2.4.0, < 3.0)
187
- rubocop-ast (1.26.0)
222
+ rubocop-ast (1.29.0)
188
223
  parser (>= 3.2.1.0)
189
- rubocop-capybara (2.17.0)
224
+ rubocop-capybara (2.19.0)
190
225
  rubocop (~> 1.41)
191
- rubocop-rails (2.17.4)
226
+ rubocop-factory_bot (2.24.0)
227
+ rubocop (~> 1.33)
228
+ rubocop-rails (2.21.2)
192
229
  activesupport (>= 4.2.0)
193
230
  rack (>= 1.1)
194
231
  rubocop (>= 1.33.0, < 2.0)
195
232
  rubocop-rake (0.6.0)
196
233
  rubocop (~> 1.0)
197
- rubocop-rspec (2.18.1)
234
+ rubocop-rspec (2.24.1)
198
235
  rubocop (~> 1.33)
199
236
  rubocop-capybara (~> 2.17)
200
- ruby-progressbar (1.11.0)
237
+ rubocop-factory_bot (~> 2.22)
238
+ ruby-progressbar (1.13.0)
239
+ ruby2_keywords (0.0.5)
201
240
  simplecov (0.22.0)
202
241
  docile (~> 1.1)
203
242
  simplecov-html (~> 0.11)
204
243
  simplecov_json_formatter (~> 0.1)
205
244
  simplecov-html (0.12.3)
206
245
  simplecov_json_formatter (0.1.4)
207
- thor (1.2.1)
208
- timeout (0.3.1)
246
+ stringio (3.0.8)
247
+ thor (1.3.0)
248
+ timeout (0.4.0)
209
249
  tzinfo (2.0.6)
210
250
  concurrent-ruby (~> 1.0)
211
- unicode-display_width (2.4.2)
212
- webrick (1.7.0)
213
- websocket-driver (0.7.5)
251
+ unicode-display_width (2.5.0)
252
+ webrick (1.8.1)
253
+ websocket-driver (0.7.6)
214
254
  websocket-extensions (>= 0.1.0)
215
255
  websocket-extensions (0.1.5)
216
256
  xpath (3.2.0)
217
257
  nokogiri (~> 1.8)
218
- yard (0.9.28)
219
- webrick (~> 1.7.0)
220
- zeitwerk (2.6.6)
258
+ yard (0.9.34)
259
+ zeitwerk (2.6.12)
221
260
 
222
261
  PLATFORMS
223
262
  x86_64-darwin-19
@@ -226,16 +265,16 @@ PLATFORMS
226
265
 
227
266
  DEPENDENCIES
228
267
  bundler (~> 2.3)
229
- capybara (~> 3.38.0)
268
+ capybara (~> 3.39.2)
230
269
  ccs-frontend_helpers!
231
270
  rake (~> 13.0)
232
- rspec (~> 3.0)
233
- rubocop (~> 1.36)
234
- rubocop-rails (~> 2.16)
271
+ rspec (~> 3.12)
272
+ rubocop (~> 1.57)
273
+ rubocop-rails (~> 2.21)
235
274
  rubocop-rake (~> 0.6)
236
- rubocop-rspec (~> 2.13)
275
+ rubocop-rspec (~> 2.24)
237
276
  simplecov (~> 0.21)
238
277
  yard (~> 0.9)
239
278
 
240
279
  BUNDLED WITH
241
- 2.3.12
280
+ 2.3.24
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Gem containing view helpers for CCS Ruby on Rails projects'
13
13
  spec.homepage = 'https://github.com/tim-s-ccs/ccs-frontend_helpers'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = '>= 2.7.0'
15
+ spec.required_ruby_version = '>= 3.0.0'
16
16
 
17
17
  # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
18
 
@@ -33,15 +33,5 @@ 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
-
46
36
  spec.metadata['rubygems_mfa_required'] = 'true'
47
37
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CCS
4
+ # Components for the GOV.UK Frontend and CCS Frontend using an Object Oriented pattern
5
+ # These are then used in the {CCS::FrontendHelpers FrontendHelpers}
6
+ # to create view helpers that can be used in a Ruby on Rails project
7
+
8
+ module Components
9
+ # Component base class that all components will inherit from.
10
+ #
11
+ # It's main purpose is to handle the initialisation of the options
12
+ # which is very similar between components
13
+ #
14
+ # @!attribute [r] options
15
+ # @return [Hash] Options for the component which defaults to +{ attributes: {} }+
16
+ # where +attributes+ are HTML attributes
17
+ # @!attribute [r] context
18
+ # @return [ActionView::Base] View context where the components are being rendered
19
+
20
+ class Base
21
+ private
22
+
23
+ attr_accessor :options, :context
24
+
25
+ public
26
+
27
+ delegate :button_tag, :concat, :label_tag, :link_to, :tag, to: :context
28
+
29
+ # @param context [ActionView::Base] the view context where the components are being rendered
30
+ # @param options [Hash] options for the component
31
+
32
+ def initialize(context:, **options)
33
+ options[:attributes] ||= {}
34
+ options[:attributes][:class] = "#{default_attributes[:class]} #{options[:classes]}".strip if default_attributes[:class] || options[:classes]
35
+ (options[:attributes][:data] ||= {})[:module] = default_attributes[:data][:module] if default_attributes.dig(:data, :module)
36
+
37
+ @context = context
38
+ @options = options
39
+ end
40
+
41
+ # The default attributes for the component
42
+
43
+ DEFAULT_ATTRIBUTES = {}.freeze
44
+
45
+ private
46
+
47
+ # The default attributes for the component
48
+ #
49
+ # @return [Hash]
50
+
51
+ def default_attributes
52
+ self.class::DEFAULT_ATTRIBUTES
53
+ end
54
+
55
+ # Sanitizes string used as HTML tag id
56
+ #
57
+ # @return [String]
58
+
59
+ def sanitize_to_id(...)
60
+ @context.send(:sanitize_to_id, ...)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,57 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module CCS
6
+ class DashboardSection < Base
7
+ # = CCS Dashboard Section Panel
8
+ #
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
17
+
18
+ class Panel < Base
19
+ private
20
+
21
+ attr_reader :title, :href, :description
22
+
23
+ public
24
+
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]
46
+
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
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end