govuk_publishing_components 24.6.0 → 24.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/component_guide/application.js +3 -0
  3. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +7 -5
  4. data/app/assets/javascripts/govuk_publishing_components/components/details.js +2 -1
  5. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +1 -0
  6. data/app/assets/javascripts/govuk_publishing_components/modules.js +3 -1
  7. data/app/assets/stylesheets/component_guide/application.scss +1 -1
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +0 -4
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +10 -1
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +8 -7
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +15 -1
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -32
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +0 -5
  14. data/app/controllers/govuk_publishing_components/audit_controller.rb +21 -17
  15. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +9 -0
  16. data/app/helpers/govuk_publishing_components/application_helper.rb +3 -0
  17. data/app/models/govuk_publishing_components/audit_applications.rb +3 -3
  18. data/app/models/govuk_publishing_components/audit_comparer.rb +16 -8
  19. data/app/models/govuk_publishing_components/audit_components.rb +6 -3
  20. data/app/views/govuk_publishing_components/audit/_applications.html.erb +126 -0
  21. data/app/views/govuk_publishing_components/audit/_components.html.erb +142 -0
  22. data/app/views/govuk_publishing_components/audit/show.html.erb +22 -277
  23. data/app/views/govuk_publishing_components/component_guide/index.html.erb +16 -0
  24. data/app/views/govuk_publishing_components/components/_image_card.html.erb +14 -11
  25. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -2
  26. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +48 -7
  27. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +15 -12
  28. data/app/views/govuk_publishing_components/components/_success_alert.html.erb +24 -8
  29. data/app/views/govuk_publishing_components/components/_summary_list.html.erb +2 -2
  30. data/app/views/govuk_publishing_components/components/_title.html.erb +6 -2
  31. data/app/views/govuk_publishing_components/components/docs/button.yml +7 -6
  32. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +3 -0
  33. data/app/views/govuk_publishing_components/components/docs/image_card.yml +12 -0
  34. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +26 -0
  35. data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +3 -0
  36. data/app/views/govuk_publishing_components/components/docs/success_alert.yml +12 -1
  37. data/app/views/govuk_publishing_components/components/docs/summary_list.yml +18 -1
  38. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +8 -1
  39. data/config/locales/ar.yml +1 -0
  40. data/config/locales/az.yml +1 -0
  41. data/config/locales/be.yml +1 -0
  42. data/config/locales/bg.yml +1 -0
  43. data/config/locales/bn.yml +1 -0
  44. data/config/locales/cs.yml +1 -0
  45. data/config/locales/da.yml +1 -0
  46. data/config/locales/de.yml +1 -0
  47. data/config/locales/dr.yml +1 -0
  48. data/config/locales/el.yml +1 -0
  49. data/config/locales/en.yml +2 -0
  50. data/config/locales/es-419.yml +1 -0
  51. data/config/locales/es.yml +1 -0
  52. data/config/locales/fa.yml +1 -0
  53. data/config/locales/fi.yml +1 -0
  54. data/config/locales/gd.yml +1 -0
  55. data/config/locales/gu.yml +1 -0
  56. data/config/locales/he.yml +1 -0
  57. data/config/locales/hi.yml +1 -0
  58. data/config/locales/hr.yml +1 -0
  59. data/config/locales/hu.yml +1 -0
  60. data/config/locales/hy.yml +1 -0
  61. data/config/locales/id.yml +1 -0
  62. data/config/locales/is.yml +1 -0
  63. data/config/locales/it.yml +1 -0
  64. data/config/locales/ja.yml +1 -0
  65. data/config/locales/ka.yml +1 -0
  66. data/config/locales/kk.yml +1 -0
  67. data/config/locales/ko.yml +1 -0
  68. data/config/locales/lt.yml +1 -0
  69. data/config/locales/lv.yml +1 -0
  70. data/config/locales/ms.yml +1 -0
  71. data/config/locales/mt.yml +1 -0
  72. data/config/locales/nl.yml +1 -0
  73. data/config/locales/no.yml +1 -0
  74. data/config/locales/pa-pk.yml +1 -0
  75. data/config/locales/pa.yml +1 -0
  76. data/config/locales/pl.yml +1 -0
  77. data/config/locales/ps.yml +1 -0
  78. data/config/locales/pt.yml +1 -0
  79. data/config/locales/ro.yml +1 -0
  80. data/config/locales/ru.yml +1 -0
  81. data/config/locales/si.yml +1 -0
  82. data/config/locales/sk.yml +1 -0
  83. data/config/locales/sl.yml +1 -0
  84. data/config/locales/so.yml +1 -0
  85. data/config/locales/sq.yml +1 -0
  86. data/config/locales/sr.yml +1 -0
  87. data/config/locales/sv.yml +1 -0
  88. data/config/locales/sw.yml +1 -0
  89. data/config/locales/ta.yml +1 -0
  90. data/config/locales/th.yml +1 -0
  91. data/config/locales/tk.yml +1 -0
  92. data/config/locales/tr.yml +1 -0
  93. data/config/locales/uk.yml +1 -0
  94. data/config/locales/ur.yml +1 -0
  95. data/config/locales/uz.yml +1 -0
  96. data/config/locales/vi.yml +1 -0
  97. data/config/locales/zh-hk.yml +1 -0
  98. data/config/locales/zh-tw.yml +1 -0
  99. data/config/locales/zh.yml +1 -0
  100. data/lib/govuk_publishing_components/presenters/button_helper.rb +13 -2
  101. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -0
  102. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +15 -31
  103. data/lib/govuk_publishing_components/presenters/shared_helper.rb +10 -0
  104. data/lib/govuk_publishing_components/version.rb +1 -1
  105. metadata +68 -6
@@ -0,0 +1,126 @@
1
+ <%
2
+ title = "Applications"
3
+ title = "This application" unless ENV["MAIN_COMPONENT_GUIDE"]
4
+ %>
5
+ <%= render "govuk_publishing_components/components/heading", {
6
+ text: title,
7
+ font_size: "l",
8
+ margin_bottom: 6
9
+ } %>
10
+
11
+ <% if @applications.any? %>
12
+ <%= render "govuk_publishing_components/components/details", {
13
+ title: "How to use this information"
14
+ } do %>
15
+ <p class="govuk-body">This page shows information about component use on GOV.UK. This information has been cross referenced with the components in the gem to produce warnings where e.g. a print stylesheet for a component exists but has not been included in an application.</p>
16
+ <p class="govuk-body">Warnings should be investigated, although there may be a reason why the application has been configured as it is. Note that 'code' can refer to templates or ruby code.</p>
17
+ <% end %>
18
+
19
+ <%
20
+ accordion_content = nil
21
+ summary = nil
22
+ %>
23
+ <% application_items = @applications.map do |application| %>
24
+ <%
25
+ summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
26
+
27
+ if application[:application_found]
28
+ summary = "Warnings: 0"
29
+ summary = "Warnings: <strong class=\"govuk-tag govuk-tag--red\">#{application[:warning_count]}</strong>" if application[:warning_count] > 0
30
+ end
31
+ %>
32
+
33
+ <% accordion_content = capture do %>
34
+ <% if application[:application_found] %>
35
+ <% application[:warnings].each do |warning| %>
36
+ <p class="govuk-body">
37
+ <strong class="govuk-tag">Warn</strong>
38
+ <strong><%= warning[:component] %></strong> - <%= warning[:message] %>
39
+ </p>
40
+ <% end %>
41
+
42
+ <%= render "govuk_publishing_components/components/heading", {
43
+ text: "Components used",
44
+ font_size: "m",
45
+ margin_bottom: 4,
46
+ heading_level: 3,
47
+ } %>
48
+
49
+ <dl class="govuk-summary-list">
50
+ <% application[:summary].each do |item| %>
51
+ <div class="govuk-summary-list__row">
52
+ <dt class="govuk-summary-list__key">
53
+ <%= item[:name] %>
54
+ </dt>
55
+ <dd class="govuk-summary-list__value">
56
+ <% if item[:value].length > 0 %>
57
+ <%= item[:value] %>
58
+ <% else %>
59
+ None
60
+ <% end %>
61
+ </dd>
62
+ </div>
63
+ <% end %>
64
+ </dl>
65
+
66
+ <% if application[:gem_style_references].any? %>
67
+ <%= render "govuk_publishing_components/components/heading", {
68
+ text: "Component references",
69
+ font_size: "m",
70
+ margin_bottom: 4,
71
+ heading_level: 3,
72
+ } %>
73
+
74
+ <p class="govuk-body">This shows instances of `gem-c-` classes found in the application. If a reference is found in a stylesheet or in code a warning is created, as this could be a style override or hard coded component markup.</p>
75
+ <ul class="govuk-list govuk-list--bullet">
76
+ <% application[:gem_style_references].each do |ref| %>
77
+ <li><%= ref %></li>
78
+ <% end %>
79
+ </ul>
80
+ <% end %>
81
+
82
+ <% if application[:jquery_references].any? %>
83
+ <%= render "govuk_publishing_components/components/heading", {
84
+ text: "jQuery references",
85
+ font_size: "m",
86
+ margin_bottom: 4,
87
+ heading_level: 3,
88
+ } %>
89
+ <p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
90
+ <ul class="govuk-list govuk-list--bullet">
91
+ <% application[:jquery_references].each do |ref| %>
92
+ <li><%= ref %></li>
93
+ <% end %>
94
+ </ul>
95
+ <% end %>
96
+ <% else %>
97
+ <p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
98
+ <% end %>
99
+ <% end %>
100
+
101
+ <%
102
+ {
103
+ heading: {
104
+ text: application[:name]
105
+ },
106
+ summary: {
107
+ text: sanitize(summary)
108
+ },
109
+ content: {
110
+ html: sanitize(accordion_content)
111
+ },
112
+ }
113
+ %>
114
+ <% end %>
115
+
116
+ <% if ENV["MAIN_COMPONENT_GUIDE"] %>
117
+ <%= render "govuk_publishing_components/components/accordion", {
118
+ items: application_items
119
+ } %>
120
+ <% else %>
121
+ <p class="govuk-body"><%= sanitize(summary) %></p>
122
+ <%= accordion_content %>
123
+ <% end %>
124
+ <% else %>
125
+ <p class="govuk-body">No applications found.</p>
126
+ <% end %>
@@ -0,0 +1,142 @@
1
+ <% if @applications_found %>
2
+ <%= render "govuk_publishing_components/components/heading", {
3
+ text: "Components",
4
+ font_size: "l",
5
+ margin_bottom: 6,
6
+ } %>
7
+ <% end %>
8
+
9
+ <% if @components.any? %>
10
+ <% component_items = [] %>
11
+
12
+ <% component_files = capture do %>
13
+ <table class="govuk-table">
14
+ <thead class="govuk-table__head">
15
+ <tr class="govuk-table__row">
16
+ <th scope="col" class="govuk-table__header sticky-table-header">Component</th>
17
+ <th scope="col" class="govuk-table__header sticky-table-header">Stylesheet</th>
18
+ <th scope="col" class="govuk-table__header sticky-table-header">Print stylesheet</th>
19
+ <th scope="col" class="govuk-table__header sticky-table-header">JS</th>
20
+ <th scope="col" class="govuk-table__header sticky-table-header">Test</th>
21
+ <th scope="col" class="govuk-table__header sticky-table-header">JS test</th>
22
+ </tr>
23
+ </thead>
24
+ <tbody class="govuk-table__body">
25
+ <% @components[:component_listing].each do |component| %>
26
+ <tr class="govuk-table__row">
27
+ <th scope="row" class="govuk-table__header">
28
+ <a href="<%= component[:link] %>" class="govuk-link"><%= component[:name] %></a>
29
+ </th>
30
+ <td class="govuk-table__cell">
31
+ <% if component[:stylesheet] %>
32
+ <strong class="govuk-tag govuk-tag--green">Yes</strong>
33
+ <% end %>
34
+ </td>
35
+ <td class="govuk-table__cell">
36
+ <% if component[:print_stylesheet] %>
37
+ <strong class="govuk-tag govuk-tag--green">Yes</strong>
38
+ <% end %>
39
+ </td>
40
+ <td class="govuk-table__cell">
41
+ <% if component[:javascript] %>
42
+ <strong class="govuk-tag govuk-tag--green">Yes</strong>
43
+ <% end %>
44
+ </td>
45
+ <td class="govuk-table__cell">
46
+ <% if component[:tests] %>
47
+ <strong class="govuk-tag govuk-tag--green">Yes</strong>
48
+ <% end %>
49
+ </td>
50
+ <td class="govuk-table__cell">
51
+ <% if component[:js_tests] %>
52
+ <strong class="govuk-tag govuk-tag--green">Yes</strong>
53
+ <% end %>
54
+ </td>
55
+ </tr>
56
+ <% end %>
57
+ </tbody>
58
+ </table>
59
+ <% end %>
60
+
61
+ <%
62
+ component_items << {
63
+ heading: {
64
+ text: "Component files",
65
+ },
66
+ summary: {
67
+ text: "Lists what files each component has",
68
+ },
69
+ content: {
70
+ html: component_files
71
+ },
72
+ }
73
+ %>
74
+
75
+ <% components_within_components = capture do %>
76
+ <dl class="govuk-summary-list">
77
+ <% @components[:components_containing_components].each do |component| %>
78
+ <div class="govuk-summary-list__row">
79
+ <dt class="govuk-summary-list__key">
80
+ <a href="<%= component[:link] %>" class="govuk-link"><%= component[:component] %></a>
81
+ </dt>
82
+ <dd class="govuk-summary-list__value">
83
+ <%= component[:sub_components].join(', ') %>
84
+ </dd>
85
+ </div>
86
+ <% end %>
87
+ </dl>
88
+ <% end %>
89
+
90
+ <%
91
+ component_items << {
92
+ heading: {
93
+ text: "Components containing other components",
94
+ },
95
+ summary: {
96
+ text: "Shows which components contain other components",
97
+ },
98
+ content: {
99
+ html: components_within_components
100
+ },
101
+ }
102
+ %>
103
+
104
+ <% if @applications_found %>
105
+ <% components_by_application = capture do %>
106
+ <% if @components[:components_by_application].any? %>
107
+ <dl class="govuk-summary-list">
108
+ <% @components[:components_by_application].each do |component| %>
109
+ <div class="govuk-summary-list__row">
110
+ <dt class="govuk-summary-list__key">
111
+ <%= component[:component] %> (<%= component[:count] %>)
112
+ </dt>
113
+ <dd class="govuk-summary-list__value">
114
+ <%= component[:list] %>
115
+ </dd>
116
+ </div>
117
+ <% end %>
118
+ </dl>
119
+ <% end %>
120
+ <% end %>
121
+
122
+ <%
123
+ component_items << {
124
+ heading: {
125
+ text: "Components by application",
126
+ },
127
+ summary: {
128
+ text: "Shows which applications use each component",
129
+ },
130
+ content: {
131
+ html: components_by_application
132
+ },
133
+ }
134
+ %>
135
+ <% end %>
136
+
137
+ <%= render "govuk_publishing_components/components/accordion", {
138
+ items: component_items
139
+ } %>
140
+ <% else %>
141
+ <p class="govuk-body">No components found.</p>
142
+ <% end %>
@@ -2,284 +2,29 @@
2
2
 
3
3
  <%= render 'govuk_publishing_components/components/title', title: "Components audit", margin_top: 0; %>
4
4
 
5
- <% if ENV["MAIN_COMPONENT_GUIDE"] %>
6
- <div class="govuk-tabs" data-module="govuk-tabs">
7
- <h2 class="govuk-tabs__title">
8
- Contents
9
- </h2>
10
- <ul class="govuk-tabs__list">
11
- <li class="govuk-tabs__list-item govuk-tabs__list-item--selected">
12
- <a class="govuk-tabs__tab" href="#applications">
13
- Applications
14
- </a>
15
- </li>
16
- <li class="govuk-tabs__list-item">
17
- <a class="govuk-tabs__tab" href="#components-gem">
18
- Components
19
- </a>
20
- </li>
21
- </ul>
22
- <div class="govuk-tabs__panel" id="applications">
23
- <%= render "govuk_publishing_components/components/heading", {
24
- text: "Applications",
25
- font_size: "l",
26
- margin_bottom: 6
27
- } %>
28
-
29
- <% if @applications.any? %>
30
- <details class="govuk-details" data-module="govuk-details">
31
- <summary class="govuk-details__summary">
32
- <span class="govuk-details__summary-text">
33
- How to use this information
34
- </span>
35
- </summary>
36
- <div class="govuk-details__text">
37
- <p class="govuk-body">This page shows information about component use on GOV.UK. This information has been cross referenced with the components in the gem to produce warnings where e.g. a print stylesheet for a component exists but has not been included in an application.</p>
38
- <p class="govuk-body">Warnings should be investigated, although there may be a reason why the application has been configured as it is. Note that 'code' can refer to templates or ruby code.</p>
39
- </div>
40
- </details>
41
-
42
- <% #application_items = [] %>
43
- <% application_items = @applications.map do |application| %>
44
- <%
45
- summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
46
-
47
- if application[:application_found]
48
- summary = "Warnings: 0"
49
- if application[:warning_count] > 0
50
- summary = "Warnings: <strong class=\"govuk-tag govuk-tag--red\">#{application[:warning_count]}</strong>"
51
- end
52
- end
53
- %>
54
-
55
- <% accordion_content = capture do %>
56
- <% if application[:application_found] %>
57
- <% application[:warnings].each do |warning| %>
58
- <p class="govuk-body">
59
- <strong class="govuk-tag">Warn</strong>
60
- <strong><%= warning[:component] %></strong> - <%= warning[:message] %>
61
- </p>
62
- <% end %>
63
-
64
- <%= render "govuk_publishing_components/components/heading", {
65
- text: "Components used",
66
- font_size: "m",
67
- margin_bottom: 4,
68
- heading_level: 3,
69
- } %>
70
-
71
- <dl class="govuk-summary-list">
72
- <% application[:summary].each do |item| %>
73
- <div class="govuk-summary-list__row">
74
- <dt class="govuk-summary-list__key">
75
- <%= item[:name] %>
76
- </dt>
77
- <dd class="govuk-summary-list__value">
78
- <% if item[:value].length > 0 %>
79
- <%= item[:value] %>
80
- <% else %>
81
- None
82
- <% end %>
83
- </dd>
84
- </div>
85
- <% end %>
86
- </dl>
87
-
88
- <% if application[:gem_style_references].any? %>
89
- <%= render "govuk_publishing_components/components/heading", {
90
- text: "Component references",
91
- font_size: "m",
92
- margin_bottom: 4,
93
- heading_level: 3,
94
- } %>
95
-
96
- <p class="govuk-body">This shows instances of `gem-c-` classes found in the application. If a reference is found in a stylesheet or in code a warning is created, as this could be a style override or hard coded component markup.</p>
97
- <ul class="govuk-list govuk-list--bullet">
98
- <% application[:gem_style_references].each do |ref| %>
99
- <li><%= ref %></li>
100
- <% end %>
101
- </ul>
102
- <% end %>
103
-
104
- <% if application[:jquery_references].any? %>
105
- <%= render "govuk_publishing_components/components/heading", {
106
- text: "jQuery references",
107
- font_size: "m",
108
- margin_bottom: 4,
109
- heading_level: 3,
110
- } %>
111
- <p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
112
- <ul class="govuk-list govuk-list--bullet">
113
- <% application[:jquery_references].each do |ref| %>
114
- <li><%= ref %></li>
115
- <% end %>
116
- </ul>
117
- <% end %>
118
- <% else %>
119
- <p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
120
- <% end %>
121
- <% end %>
122
-
123
- <%
124
- {
125
- heading: {
126
- text: application[:name]
127
- },
128
- summary: {
129
- text: sanitize(summary)
130
- },
131
- content: {
132
- html: sanitize(accordion_content)
133
- },
134
- }
135
- %>
136
- <% end %>
137
-
138
- <%= render "govuk_publishing_components/components/accordion", {
139
- items: application_items
140
- } %>
141
- <% else %>
142
- <p class="govuk-body">No applications found.</p>
143
- <% end %>
144
- </div>
145
-
146
- <div class="govuk-tabs__panel govuk-tabs__panel--hidden" id="components-gem">
147
- <%= render "govuk_publishing_components/components/heading", {
148
- text: "Components",
149
- font_size: "l",
150
- margin_bottom: 6,
151
- } %>
152
-
153
- <% if @components.any? %>
154
- <% component_files = capture do %>
155
- <table class="govuk-table">
156
- <thead class="govuk-table__head">
157
- <tr class="govuk-table__row">
158
- <th scope="col" class="govuk-table__header sticky-table-header">Component</th>
159
- <th scope="col" class="govuk-table__header sticky-table-header">Stylesheet</th>
160
- <th scope="col" class="govuk-table__header sticky-table-header">Print stylesheet</th>
161
- <th scope="col" class="govuk-table__header sticky-table-header">JS</th>
162
- <th scope="col" class="govuk-table__header sticky-table-header">Test</th>
163
- <th scope="col" class="govuk-table__header sticky-table-header">JS test</th>
164
- </tr>
165
- </thead>
166
- <tbody class="govuk-table__body">
167
- <% @components[:component_listing].each do |component| %>
168
- <tr class="govuk-table__row">
169
- <th scope="row" class="govuk-table__header">
170
- <a href="<%= component[:link] %>" class="govuk-link"><%= component[:name] %></a>
171
- </th>
172
- <td class="govuk-table__cell">
173
- <% if component[:stylesheet] %>
174
- <strong class="govuk-tag govuk-tag--green">Yes</strong>
175
- <% end %>
176
- </td>
177
- <td class="govuk-table__cell">
178
- <% if component[:print_stylesheet] %>
179
- <strong class="govuk-tag govuk-tag--green">Yes</strong>
180
- <% end %>
181
- </td>
182
- <td class="govuk-table__cell">
183
- <% if component[:javascript] %>
184
- <strong class="govuk-tag govuk-tag--green">Yes</strong>
185
- <% end %>
186
- </td>
187
- <td class="govuk-table__cell">
188
- <% if component[:tests] %>
189
- <strong class="govuk-tag govuk-tag--green">Yes</strong>
190
- <% end %>
191
- </td>
192
- <td class="govuk-table__cell">
193
- <% if component[:js_tests] %>
194
- <strong class="govuk-tag govuk-tag--green">Yes</strong>
195
- <% end %>
196
- </td>
197
- </tr>
198
- <% end %>
199
- </tbody>
200
- </table>
201
- <% end %>
202
-
203
- <% components_within_components = capture do %>
204
- <dl class="govuk-summary-list">
205
- <% @components[:components_containing_components].each do |component| %>
206
- <div class="govuk-summary-list__row">
207
- <dt class="govuk-summary-list__key">
208
- <a href="<%= component[:link] %>" class="govuk-link"><%= component[:component] %></a>
209
- </dt>
210
- <dd class="govuk-summary-list__value">
211
- <%= component[:sub_components].join(', ') %>
212
- </dd>
213
- </div>
214
- <% end %>
215
- </dl>
216
- <% end %>
217
-
218
- <% components_by_application = capture do %>
219
- <% if @components[:components_by_application].any? %>
220
- <dl class="govuk-summary-list">
221
- <% @components[:components_by_application].each do |component| %>
222
- <div class="govuk-summary-list__row">
223
- <dt class="govuk-summary-list__key">
224
- <%= component[:component] %> (<%= component[:count] %>)
225
- </dt>
226
- <dd class="govuk-summary-list__value">
227
- <%= component[:list] %>
228
- </dd>
229
- </div>
230
- <% end %>
231
- </dl>
232
- <% else %>
233
- <p class="govuk-body">Sorry, no applications found.</p>
234
- <% end %>
235
- <% end %>
5
+ <% applications = capture do %>
6
+ <%= render "applications" %>
7
+ <% end %>
236
8
 
237
- <%
238
- component_items = [
239
- {
240
- heading: {
241
- text: "Component files",
242
- },
243
- summary: {
244
- text: "Lists what files each component has",
245
- },
246
- content: {
247
- html: component_files
248
- },
249
- },
250
- {
251
- heading: {
252
- text: "Components containing other components",
253
- },
254
- summary: {
255
- text: "Shows which components contain other components",
256
- },
257
- content: {
258
- html: components_within_components
259
- },
260
- },
261
- {
262
- heading: {
263
- text: "Components by application",
264
- },
265
- summary: {
266
- text: "Shows which applications use each component",
267
- },
268
- content: {
269
- html: components_by_application
270
- },
271
- },
272
- ]
273
- %>
9
+ <% components = capture do %>
10
+ <%= render "components" %>
11
+ <% end %>
274
12
 
275
- <%= render "govuk_publishing_components/components/accordion", {
276
- items: component_items
277
- } %>
278
- <% else %>
279
- <p class="govuk-body">No components found.</p>
280
- <% end %>
281
- </div>
282
- </div>
13
+ <% if @applications_found %>
14
+ <%= render "govuk_publishing_components/components/tabs", {
15
+ tabs: [
16
+ {
17
+ id: "applications",
18
+ label: "Applications",
19
+ content: applications,
20
+ },
21
+ {
22
+ id: "components-gem",
23
+ label: "Components",
24
+ content: components,
25
+ }
26
+ ]
27
+ } %>
283
28
  <% else %>
284
- <p class="govuk-body">Component auditing is only available when the component guide is running locally as a standalone app.</p>
29
+ <%= render "components" %>
285
30
  <% end %>