govuk_publishing_components 24.6.1 → 24.9.1

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 (102) 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/details.js +2 -1
  4. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +1 -0
  5. data/app/assets/javascripts/govuk_publishing_components/modules.js +3 -1
  6. data/app/assets/stylesheets/component_guide/application.scss +1 -1
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +0 -4
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +10 -1
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +8 -7
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +15 -1
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -32
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +0 -5
  13. data/app/controllers/govuk_publishing_components/audit_controller.rb +21 -17
  14. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +9 -0
  15. data/app/helpers/govuk_publishing_components/application_helper.rb +3 -0
  16. data/app/models/govuk_publishing_components/audit_applications.rb +3 -3
  17. data/app/models/govuk_publishing_components/audit_comparer.rb +16 -8
  18. data/app/models/govuk_publishing_components/audit_components.rb +6 -3
  19. data/app/views/govuk_publishing_components/audit/_applications.html.erb +126 -0
  20. data/app/views/govuk_publishing_components/audit/_components.html.erb +142 -0
  21. data/app/views/govuk_publishing_components/audit/show.html.erb +22 -277
  22. data/app/views/govuk_publishing_components/component_guide/index.html.erb +16 -0
  23. data/app/views/govuk_publishing_components/components/_image_card.html.erb +14 -11
  24. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -2
  25. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +48 -7
  26. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +15 -12
  27. data/app/views/govuk_publishing_components/components/_success_alert.html.erb +24 -8
  28. data/app/views/govuk_publishing_components/components/_title.html.erb +6 -2
  29. data/app/views/govuk_publishing_components/components/docs/button.yml +7 -6
  30. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +3 -0
  31. data/app/views/govuk_publishing_components/components/docs/image_card.yml +12 -0
  32. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +26 -0
  33. data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +3 -0
  34. data/app/views/govuk_publishing_components/components/docs/success_alert.yml +12 -1
  35. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +8 -1
  36. data/config/locales/ar.yml +1 -0
  37. data/config/locales/az.yml +1 -0
  38. data/config/locales/be.yml +1 -0
  39. data/config/locales/bg.yml +1 -0
  40. data/config/locales/bn.yml +1 -0
  41. data/config/locales/cs.yml +1 -0
  42. data/config/locales/da.yml +1 -0
  43. data/config/locales/de.yml +1 -0
  44. data/config/locales/dr.yml +1 -0
  45. data/config/locales/el.yml +1 -0
  46. data/config/locales/en.yml +2 -0
  47. data/config/locales/es-419.yml +1 -0
  48. data/config/locales/es.yml +1 -0
  49. data/config/locales/fa.yml +1 -0
  50. data/config/locales/fi.yml +1 -0
  51. data/config/locales/gd.yml +1 -0
  52. data/config/locales/gu.yml +1 -0
  53. data/config/locales/he.yml +1 -0
  54. data/config/locales/hi.yml +1 -0
  55. data/config/locales/hr.yml +1 -0
  56. data/config/locales/hu.yml +1 -0
  57. data/config/locales/hy.yml +1 -0
  58. data/config/locales/id.yml +1 -0
  59. data/config/locales/is.yml +1 -0
  60. data/config/locales/it.yml +1 -0
  61. data/config/locales/ja.yml +1 -0
  62. data/config/locales/ka.yml +1 -0
  63. data/config/locales/kk.yml +1 -0
  64. data/config/locales/ko.yml +1 -0
  65. data/config/locales/lt.yml +1 -0
  66. data/config/locales/lv.yml +1 -0
  67. data/config/locales/ms.yml +1 -0
  68. data/config/locales/mt.yml +1 -0
  69. data/config/locales/nl.yml +1 -0
  70. data/config/locales/no.yml +1 -0
  71. data/config/locales/pa-pk.yml +1 -0
  72. data/config/locales/pa.yml +1 -0
  73. data/config/locales/pl.yml +1 -0
  74. data/config/locales/ps.yml +1 -0
  75. data/config/locales/pt.yml +1 -0
  76. data/config/locales/ro.yml +1 -0
  77. data/config/locales/ru.yml +1 -0
  78. data/config/locales/si.yml +1 -0
  79. data/config/locales/sk.yml +1 -0
  80. data/config/locales/sl.yml +1 -0
  81. data/config/locales/so.yml +1 -0
  82. data/config/locales/sq.yml +1 -0
  83. data/config/locales/sr.yml +1 -0
  84. data/config/locales/sv.yml +1 -0
  85. data/config/locales/sw.yml +1 -0
  86. data/config/locales/ta.yml +1 -0
  87. data/config/locales/th.yml +1 -0
  88. data/config/locales/tk.yml +1 -0
  89. data/config/locales/tr.yml +1 -0
  90. data/config/locales/uk.yml +1 -0
  91. data/config/locales/ur.yml +1 -0
  92. data/config/locales/uz.yml +1 -0
  93. data/config/locales/vi.yml +1 -0
  94. data/config/locales/zh-hk.yml +1 -0
  95. data/config/locales/zh-tw.yml +1 -0
  96. data/config/locales/zh.yml +1 -0
  97. data/lib/govuk_publishing_components/presenters/button_helper.rb +13 -2
  98. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -4
  99. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +15 -31
  100. data/lib/govuk_publishing_components/presenters/shared_helper.rb +10 -0
  101. data/lib/govuk_publishing_components/version.rb +1 -1
  102. metadata +68 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8b508d510a7aa8f9311afcb0cbb99c28c02b8128e231fbddea0ceac450bda59
4
- data.tar.gz: 2fc60e40d72fdb1fd6dfb635782a982e5105c4df41d8a40e71ff2985b669eaed
3
+ metadata.gz: ed769524a5b5079bce70c275a1cb341e287f5575bdb669b389b045f3aa79e50c
4
+ data.tar.gz: bf256f385c94da52726c3685d92f42239f08347d9f6506930f5773839ea81b8e
5
5
  SHA512:
6
- metadata.gz: 2a43864b134f08d16145c1f39ade8bb21de88cfbe9e2f9bb92af0780e2cce92da0381495a61a9d95e40f80d66a6a739ba75ad00b18c975df2f2ccd8232749d2c
7
- data.tar.gz: a379f9f22980a8dbddd8e0af9752055ad8f93fd45a144a1a339d153c5670d26e6bbbda904acd13b91c56e0e797a8e9ed5b82cd190dd9926810d2c41d12ba4691
6
+ metadata.gz: b95c734d8d88b6193ce60fb522787b947b6cefd2d5d35dfa13eb681786155689714b1838f7d67aa6a3fcdf222388a72216a1ec9db78bdf854429356673225026
7
+ data.tar.gz: f94cb6822b42112e4bc47516a27ffdc302163da8b27c01f9be865f06bdaad146e6d346609bd570f6197993af8e9044aec51deb59042e1a33aa2b1ef0732169c2
@@ -1,2 +1,5 @@
1
1
  //= require_tree ./vendor
2
2
  //= require_tree .
3
+ //= require ../govuk_publishing_components/dependencies
4
+ //= require ../govuk_publishing_components/components/accordion
5
+ //= require ../govuk_publishing_components/components/tabs
@@ -1,7 +1,8 @@
1
1
  /* eslint-env jquery */
2
2
  // = require govuk/components/details/details.js
3
3
  window.GOVUK = window.GOVUK || {}
4
- window.GOVUK.Modules = window.GOVUK.Modules || {};
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Details = window.GOVUKFrontend;
5
6
 
6
7
  (function (Modules) {
7
8
  function GovukDetails () { }
@@ -25,6 +25,7 @@
25
25
  govuk_browser_upgrade_dismisssed: 'settings',
26
26
  govuk_not_first_visit: 'settings',
27
27
  analytics_next_page_call: 'usage',
28
+ user_nation: 'settings',
28
29
  _ga: 'usage',
29
30
  _gid: 'usage',
30
31
  _gat: 'usage',
@@ -40,7 +40,9 @@
40
40
  module = new GOVUK.Modules[moduleName]()
41
41
  module.start(element)
42
42
  element.data('module-started', true)
43
- } else if ( // GOV.UK Frontend Modules
43
+ }
44
+
45
+ if ( // GOV.UK Frontend Modules
44
46
  typeof GOVUK.Modules[frontendModuleName] === 'function' &&
45
47
  GOVUK.Modules[frontendModuleName].prototype.init &&
46
48
  !started
@@ -148,7 +148,7 @@ $gem-guide-border-width: 1px;
148
148
 
149
149
  .component-guide-preview--simple {
150
150
  border: 0;
151
- padding: 0;
151
+ padding: govuk-spacing(2);
152
152
 
153
153
  &:before {
154
154
  display: none;
@@ -59,12 +59,10 @@
59
59
  }
60
60
 
61
61
  .gem-c-image-card__title {
62
- @include govuk-font(19, $weight: bold);
63
62
  margin: 0;
64
63
  }
65
64
 
66
65
  .gem-c-image-card__title-link {
67
- @extend %govuk-link;
68
66
  text-decoration: none;
69
67
 
70
68
  &:hover {
@@ -136,7 +134,6 @@
136
134
  }
137
135
 
138
136
  .gem-c-image-card__list-item-link {
139
- @extend %govuk-link;
140
137
  line-height: 1.35em;
141
138
  }
142
139
 
@@ -193,7 +190,6 @@
193
190
  }
194
191
 
195
192
  .gem-c-image-card__title {
196
- @include govuk-font(24, $weight: bold);
197
193
  padding-bottom: govuk-spacing(2);
198
194
  }
199
195
 
@@ -1,4 +1,13 @@
1
1
  .gem-c-layout-for-public {
2
- margin: 0;
3
2
  font-family: $govuk-font-family;
4
3
  }
4
+
5
+ .gem-c-layout-for-public__blue-bar {
6
+ background: $govuk-brand-colour;
7
+ height: govuk-spacing(2);
8
+ }
9
+
10
+ .js-enabled .gem-c-layout-for-public__global-banner-wrapper {
11
+ margin-top: - govuk-spacing(2);
12
+ position: relative;
13
+ }
@@ -78,12 +78,14 @@
78
78
  }
79
79
  }
80
80
 
81
- .gem-c-layout-header__search.govuk-grid-column-one-third-from-desktop,
82
- .gem-c-layout-header__logo.govuk-grid-column-one-third-from-desktop,
83
- .gem-c-layout-header__search.govuk-grid-column-one-third,
84
- .gem-c-layout-header__logo.govuk-grid-column-two-thirds {
85
- padding-right: 0;
86
- padding-left: 0;
81
+ @include govuk-compatibility(govuk_template) {
82
+ .gem-c-layout-header__search.govuk-grid-column-one-third-from-desktop,
83
+ .gem-c-layout-header__logo.govuk-grid-column-one-third-from-desktop,
84
+ .gem-c-layout-header__search.govuk-grid-column-one-third,
85
+ .gem-c-layout-header__logo.govuk-grid-column-two-thirds {
86
+ padding-right: 0;
87
+ padding-left: 0;
88
+ }
87
89
  }
88
90
 
89
91
  .gem-c-layout-header__logo,
@@ -104,7 +106,6 @@
104
106
 
105
107
  .gem-c-header__content.govuk-header__content {
106
108
  width: auto;
107
- padding-left: 0;
108
109
 
109
110
  @include govuk-media-query($from: desktop) {
110
111
  float: right;
@@ -9,7 +9,6 @@ $large-input-size: 50px;
9
9
  .gem-c-search__label {
10
10
  @include govuk-font($size: 19, $line-height: $input-size);
11
11
  display: block;
12
- background: govuk-colour("white");
13
12
  color: $govuk-text-colour;
14
13
 
15
14
  h1 {
@@ -25,6 +24,7 @@ $large-input-size: 50px;
25
24
  padding-left: govuk-spacing(3);
26
25
  z-index: 1;
27
26
  color: $govuk-secondary-text-colour;
27
+ background: govuk-colour("white");
28
28
  }
29
29
 
30
30
  // match label colour with the label component colour
@@ -144,6 +144,10 @@ $large-input-size: 50px;
144
144
  }
145
145
 
146
146
  .gem-c-search--on-govuk-blue {
147
+ .gem-c-search__label {
148
+ color: govuk-colour("white");
149
+ }
150
+
147
151
  .gem-c-search__input {
148
152
  border-width: 0;
149
153
 
@@ -191,9 +195,19 @@ $large-input-size: 50px;
191
195
  }
192
196
 
193
197
  .gem-c-search--no-border {
198
+ .gem-c-search__label {
199
+ color: govuk-colour("white");
200
+ }
201
+
194
202
  .gem-c-search__input[type="search"] {
195
203
  border: 0;
196
204
  }
205
+
206
+ .js-enabled & {
207
+ .gem-c-search__label {
208
+ color: $govuk-secondary-text-colour;
209
+ }
210
+ }
197
211
  }
198
212
 
199
213
  .gem-c-search--large {
@@ -1,36 +1,5 @@
1
- .gem-c-success-alert {
2
- color: $govuk-text-colour;
3
- padding: govuk-spacing(3);
4
- border: $govuk-border-width-narrow solid $govuk-success-colour;
5
- @include govuk-responsive-margin(8, "bottom");
6
-
7
- @include govuk-media-query($from: tablet) {
8
- padding: govuk-spacing(4);
9
- border-width: $govuk-border-width;
10
- }
11
- }
1
+ @import "govuk/components/notification-banner/notification-banner";
12
2
 
13
3
  .gem-c-success-alert__message {
14
4
  @include govuk-font(19, $weight: bold);
15
- margin: 0;
16
- }
17
-
18
- .gem-c-success-summary__title {
19
- margin-top: 0;
20
- margin-bottom: govuk-spacing(3);
21
-
22
- @include govuk-media-query($from: tablet) {
23
- margin-bottom: govuk-spacing(4);
24
- }
25
-
26
- @include govuk-font(24, $weight: bold);
27
- }
28
-
29
- .gem-c-success-summary__body {
30
- @include govuk-font(19);
31
- margin: 0;
32
- }
33
-
34
- .gem-c-success-alert:focus {
35
- outline: $govuk-focus-width solid $govuk-focus-colour;
36
5
  }
@@ -26,10 +26,5 @@
26
26
  }
27
27
 
28
28
  .gem-c-title__text {
29
- @extend %govuk-heading-xl;
30
29
  margin: 0;
31
30
  }
32
-
33
- .gem-c-title__text--long {
34
- @extend %govuk-heading-l;
35
- }
@@ -1,22 +1,7 @@
1
1
  module GovukPublishingComponents
2
2
  class AuditController < GovukPublishingComponents::ApplicationController
3
3
  def show
4
- path = Dir.pwd
5
-
6
- components = AuditComponents.new(path)
7
- applications = analyse_applications(File.expand_path("..", path))
8
- compared_data = AuditComparer.new(components.data, applications)
9
-
10
- @applications = compared_data.applications_data || []
11
- @components = compared_data.gem_data || []
12
- end
13
-
14
- private
15
-
16
- def analyse_applications(path)
17
- results = []
18
- applications = %w[
19
- calculators
4
+ application_dirs = %w[
20
5
  collections
21
6
  collections-publisher
22
7
  content-data-admin
@@ -42,10 +27,29 @@ module GovukPublishingComponents
42
27
  travel-advice-publisher
43
28
  whitehall
44
29
  ].sort
30
+ application_dirs = [GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(Rails.root)] unless ENV["MAIN_COMPONENT_GUIDE"]
31
+
32
+ gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
33
+ gem_path = Dir.pwd if ENV["MAIN_COMPONENT_GUIDE"]
34
+
35
+ components = AuditComponents.new(gem_path, false)
36
+ applications = analyse_applications(File.expand_path("..", gem_path), application_dirs)
37
+ compared_data = AuditComparer.new(components.data, applications, false)
38
+
39
+ @applications = compared_data.applications_data || []
40
+ @components = compared_data.gem_data || []
41
+ end
42
+
43
+ private
44
+
45
+ def analyse_applications(path, application_dirs)
46
+ results = []
47
+ @applications_found = false
45
48
 
46
- applications.each do |application|
49
+ application_dirs.each do |application|
47
50
  application_path = [path, application].join("/")
48
51
  app = AuditApplications.new(application_path, application)
52
+ @applications_found = true if app.data[:application_found]
49
53
  results << app.data
50
54
  end
51
55
 
@@ -13,6 +13,7 @@ module GovukPublishingComponents
13
13
  @components_in_use_sass = components_in_use_sass(false)
14
14
  @components_in_use_print_sass = components_in_use_sass(true)
15
15
  @components_in_use_js = components_in_use_js
16
+ @index_audit_summary = index_audit_summary
16
17
  end
17
18
 
18
19
  def show
@@ -161,5 +162,13 @@ module GovukPublishingComponents
161
162
  h[:url] = component_doc_path(component_doc.id) if component_example
162
163
  end
163
164
  end
165
+
166
+ def index_audit_summary
167
+ components_gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
168
+ components = AuditComponents.new(components_gem_path, true)
169
+ application = AuditApplications.new(@application_path, GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(@application_path))
170
+ compared_data = AuditComparer.new(components.data, [application.data], true)
171
+ compared_data.applications_data[0]
172
+ end
164
173
  end
165
174
  end
@@ -1,4 +1,7 @@
1
1
  module GovukPublishingComponents
2
2
  module ApplicationHelper
3
+ def self.get_application_name_from_path(path)
4
+ path.to_s.split("/")[-1]
5
+ end
3
6
  end
4
7
  end
@@ -86,8 +86,8 @@ module GovukPublishingComponents
86
86
  gem_style_references = find_code_references(file, src, /gem-c-[-_a-zA-Z]+/)
87
87
  @gem_style_references << gem_style_references if gem_style_references
88
88
  end
89
- rescue StandardError
90
- puts "File #{file} not found"
89
+ rescue StandardError => e
90
+ puts e.message
91
91
  end
92
92
 
93
93
  components_found.flatten.uniq.sort
@@ -108,7 +108,7 @@ module GovukPublishingComponents
108
108
  end
109
109
 
110
110
  def find_code_references(file, src, regex)
111
- clean_file_path = /(?<=#{Regexp.escape(@path)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
111
+ clean_file_path = /(?<=#{Regexp.escape(@path.to_s)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
112
112
 
113
113
  return file[clean_file_path] if regex.match?(src)
114
114
  end
@@ -2,10 +2,10 @@ module GovukPublishingComponents
2
2
  class AuditComparer
3
3
  attr_reader :applications_data, :gem_data
4
4
 
5
- def initialize(gem_data, results)
5
+ def initialize(gem_data, results, simple)
6
6
  if gem_data[:gem_found]
7
7
  @gem_data = gem_data
8
- @applications_data = sort_results(results)
8
+ @applications_data = sort_results(results, simple)
9
9
  @gem_data[:components_by_application] = get_components_by_application || []
10
10
  end
11
11
  end
@@ -16,7 +16,8 @@ module GovukPublishingComponents
16
16
  key.to_s.gsub("_", " ").capitalize
17
17
  end
18
18
 
19
- def sort_results(results)
19
+ def sort_results(results, simple)
20
+ @simple = simple
20
21
  data = []
21
22
 
22
23
  results.each do |result|
@@ -40,10 +41,9 @@ module GovukPublishingComponents
40
41
  warnings << warn_about_jquery_references(result[:jquery_references])
41
42
  warnings = warnings.flatten
42
43
 
43
- data << {
44
- name: result[:name],
45
- application_found: result[:application_found],
46
- summary: [
44
+ summary = []
45
+ unless @simple
46
+ summary = [
47
47
  {
48
48
  name: "Components in templates",
49
49
  value: templates[:components].flatten.uniq.sort.join(", "),
@@ -64,7 +64,13 @@ module GovukPublishingComponents
64
64
  name: "Components in ruby",
65
65
  value: ruby[:components].join(", "),
66
66
  },
67
- ],
67
+ ]
68
+ end
69
+
70
+ data << {
71
+ name: result[:name],
72
+ application_found: result[:application_found],
73
+ summary: summary,
68
74
  warnings: warnings,
69
75
  warning_count: warnings.length,
70
76
  gem_style_references: result[:gem_style_references],
@@ -180,6 +186,8 @@ module GovukPublishingComponents
180
186
  end
181
187
 
182
188
  def get_components_by_application
189
+ return [] if @simple
190
+
183
191
  results = []
184
192
  found_something = false
185
193
 
@@ -2,16 +2,17 @@ module GovukPublishingComponents
2
2
  class AuditComponents
3
3
  attr_reader :data
4
4
 
5
- def initialize(path)
5
+ def initialize(path, simple)
6
6
  @data = {
7
7
  gem_found: false,
8
8
  }
9
- @data = compile_data(path) if Dir.exist?(path)
9
+ @data = compile_data(path, simple) if Dir.exist?(path)
10
10
  end
11
11
 
12
12
  private
13
13
 
14
- def compile_data(path)
14
+ def compile_data(path, simple)
15
+ @simple = simple
15
16
  templates_path = "app/views/govuk_publishing_components/components"
16
17
  stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components"
17
18
  print_stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components/print"
@@ -128,6 +129,8 @@ module GovukPublishingComponents
128
129
  end
129
130
 
130
131
  def list_all_component_details
132
+ return [] if @simple
133
+
131
134
  all_component_information = []
132
135
 
133
136
  @components.each do |component|
@@ -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 %>