govuk_publishing_components 29.6.0 → 29.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +72 -73
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +11 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-click-tracking.js +49 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
  6. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +0 -1
  7. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +20 -6
  8. data/app/assets/javascripts/govuk_publishing_components/modules.js +0 -1
  9. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-measurer.js +37 -0
  10. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +166 -142
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +11 -4
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -1
  13. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +1 -1
  14. data/app/controllers/govuk_publishing_components/audit_controller.rb +1 -4
  15. data/app/models/govuk_publishing_components/audit_components.rb +61 -24
  16. data/app/views/govuk_publishing_components/audit/_applications.html.erb +8 -3
  17. data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +82 -0
  18. data/app/views/govuk_publishing_components/audit/_components.html.erb +2 -47
  19. data/app/views/govuk_publishing_components/component_guide/index.html.erb +2 -2
  20. data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
  21. data/app/views/govuk_publishing_components/components/_attachment.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +1 -1
  23. data/app/views/govuk_publishing_components/components/_cards.html.erb +13 -11
  24. data/app/views/govuk_publishing_components/components/_summary_list.html.erb +4 -5
  25. data/app/views/govuk_publishing_components/components/docs/contents_list.yml +1 -1
  26. data/app/views/govuk_publishing_components/components/docs/document_list.yml +4 -4
  27. data/app/views/govuk_publishing_components/components/docs/heading.yml +1 -1
  28. data/app/views/govuk_publishing_components/components/docs/image_card.yml +1 -1
  29. data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +4 -4
  30. data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -1
  31. data/app/views/govuk_publishing_components/components/docs/share_links.yml +1 -1
  32. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +1 -1
  33. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +1 -2
  34. data/config/locales/en.yml +0 -2
  35. data/lib/generators/govuk_publishing_components/templates/_component.html.erb +1 -1
  36. data/lib/govuk_publishing_components/app_helpers/brand_helper.rb +1 -1
  37. data/lib/govuk_publishing_components/presenters/{attachment.rb → attachment_helper.rb} +1 -2
  38. data/lib/govuk_publishing_components/version.rb +1 -1
  39. data/lib/govuk_publishing_components.rb +1 -1
  40. metadata +7 -4
@@ -50,12 +50,19 @@
50
50
  // We use grid to split the container into column widths, so manage the horizontal spacing with
51
51
  // internal margins.
52
52
  margin: 0 govuk-spacing(3);
53
- padding: govuk-spacing(3) 0 govuk-spacing(6) 0;
53
+ padding: govuk-spacing(1) 0 govuk-spacing(4) 0;
54
+ }
55
+
56
+ .gem-c-cards__list-item-wrapper {
57
+ // this wrapper ensures that the clickable area of the card only
58
+ // covers the area of the card containing text so in a grid of cards
59
+ // there is space above and below each link
60
+ padding: govuk-spacing(2) govuk-spacing(6) govuk-spacing(2) 0;
54
61
  position: relative;
55
62
  }
56
63
 
57
64
  .gem-c-cards__sub-heading {
58
- margin: 0 govuk-spacing(6) govuk-spacing(2) 0;
65
+ margin-bottom: govuk-spacing(2);
59
66
  }
60
67
 
61
68
  .gem-c-cards__link {
@@ -79,7 +86,7 @@
79
86
  height: $dimension;
80
87
  position: absolute;
81
88
  right: govuk-spacing(1);
82
- top: govuk-spacing(4);
89
+ top: govuk-spacing(3);
83
90
  @include prefixed-transform($rotate: 45deg);
84
91
  width: $dimension;
85
92
  }
@@ -98,5 +105,5 @@
98
105
  }
99
106
 
100
107
  .gem-c-cards__description {
101
- margin: 0;
108
+ margin: 0 govuk-spacing(-6) 0 0;
102
109
  }
@@ -816,7 +816,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
816
816
 
817
817
  .gem-c-layout-super-navigation-header__navigation-second-items--topics {
818
818
  @include govuk-media-query($from: "desktop") {
819
- @include columns($items: 17, $columns: 2, $selector: "li", $flow: column);
819
+ @include columns($items: 16, $columns: 2, $selector: "li", $flow: column);
820
820
  }
821
821
  }
822
822
 
@@ -16,7 +16,7 @@
16
16
  // This block is duplicated from Whitehall as a transitional step, see the
17
17
  // commit message for 2d893c10ee3f2cab27162b9aba38b12379a71d07 before making
18
18
  // changes, original version:
19
- // https://github.com/alphagov/whitehall/blob/master/app/assets/stylesheets/frontend/helpers/_attachment.scss
19
+ // https://github.com/alphagov/whitehall/blob/main/app/assets/stylesheets/frontend/helpers/_attachment.scss
20
20
  $thumbnail-width: 99px;
21
21
 
22
22
  .attachment {
@@ -13,8 +13,6 @@ module GovukPublishingComponents
13
13
  frontend
14
14
  government-frontend
15
15
  govspeak-preview
16
- govuk-account-manager-prototype
17
- govuk-coronavirus-vulnerable-people-form
18
16
  info-frontend
19
17
  licence-finder
20
18
  manuals-frontend
@@ -32,10 +30,9 @@ module GovukPublishingComponents
32
30
  gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
33
31
  gem_path = Dir.pwd if ENV["MAIN_COMPONENT_GUIDE"]
34
32
  host_dir = File.expand_path("..")
35
- path = File.expand_path("..", gem_path)
36
33
 
37
34
  @in_application = false
38
- @in_application = true unless path.to_s == host_dir.to_s
35
+ @in_application = true unless ENV["MAIN_COMPONENT_GUIDE"]
39
36
 
40
37
  components = AuditComponents.new(gem_path, false)
41
38
  applications = analyse_applications(host_dir, application_dirs)
@@ -12,29 +12,40 @@ module GovukPublishingComponents
12
12
  private
13
13
 
14
14
  def compile_data(path, simple)
15
+ # simple is used to reduce effort (and therefore page load time) required
16
+ # when loading auditing summary on the main component guide page
15
17
  @simple = simple
16
- templates_path = "app/views/govuk_publishing_components/components"
17
- stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components"
18
- print_stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components/print"
19
- javascripts_path = "app/assets/javascripts/govuk_publishing_components/components"
20
- tests_path = "spec/components"
21
- js_tests_path = "spec/javascripts/components"
22
-
23
- templates = Dir["#{path}/#{templates_path}/*.erb"]
24
- stylesheets = Dir["#{path}/#{stylesheets_path}/*.scss"]
25
- print_stylesheets = Dir["#{path}/#{print_stylesheets_path}/*.scss"]
26
- javascripts = Dir["#{path}/#{javascripts_path}/*.js"]
27
- tests = Dir["#{path}/#{tests_path}/*.rb"]
28
- js_tests = Dir["#{path}/#{js_tests_path}/*.js"]
29
-
30
- @templates_full_path = "#{path}/#{templates_path}/"
31
-
32
- @components = find_files(templates, [path, templates_path].join("/"))
33
- @component_stylesheets = find_files(stylesheets, [path, stylesheets_path].join("/"))
34
- @component_print_stylesheets = find_files(print_stylesheets, [path, print_stylesheets_path].join("/"))
35
- @component_javascripts = find_files(javascripts, [path, javascripts_path].join("/"))
36
- @component_tests = find_files(tests, [path, tests_path].join("/"))
37
- @component_js_tests = find_files(js_tests, [path, js_tests_path].join("/"))
18
+
19
+ # paths to key file locations
20
+ @templates_path = "app/views/govuk_publishing_components/components"
21
+ @stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components"
22
+ @print_stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components/print"
23
+ @javascripts_path = "app/assets/javascripts/govuk_publishing_components/components"
24
+ @tests_path = "spec/components"
25
+ @js_tests_path = "spec/javascripts/components"
26
+ @helpers_path = "lib/govuk_publishing_components/presenters"
27
+
28
+ # get all files in key file locations
29
+ templates = Dir["#{path}/#{@templates_path}/*.erb"]
30
+ stylesheets = Dir["#{path}/#{@stylesheets_path}/*.scss"]
31
+ print_stylesheets = Dir["#{path}/#{@print_stylesheets_path}/*.scss"]
32
+ javascripts = Dir["#{path}/#{@javascripts_path}/*.js"]
33
+ tests = Dir["#{path}/#{@tests_path}/*.rb"]
34
+ js_tests = Dir["#{path}/#{@js_tests_path}/*.js"]
35
+ helpers = Dir["#{path}/#{@helpers_path}/*_helper.rb"]
36
+
37
+ @templates_full_path = "#{path}/#{@templates_path}/"
38
+
39
+ # find the cleaned names of components in key file locations
40
+ # i.e. will show that 'component name' has a stylesheet
41
+ # standardised like this to be used later for easier comparison
42
+ @components = clean_files(templates, [path, @templates_path].join("/"))
43
+ @component_stylesheets = clean_files(stylesheets, [path, @stylesheets_path].join("/"))
44
+ @component_print_stylesheets = clean_files(print_stylesheets, [path, @print_stylesheets_path].join("/"))
45
+ @component_javascripts = clean_files(javascripts, [path, @javascripts_path].join("/"))
46
+ @component_tests = clean_files(tests, [path, @tests_path].join("/"))
47
+ @component_js_tests = clean_files(js_tests, [path, @js_tests_path].join("/"))
48
+ @component_helpers = clean_files(helpers, [path, @helpers_path].join("/"))
38
49
 
39
50
  {
40
51
  gem_found: true,
@@ -44,12 +55,13 @@ module GovukPublishingComponents
44
55
  component_javascripts: @component_javascripts,
45
56
  component_tests: @component_tests,
46
57
  component_js_tests: @component_js_tests,
58
+ component_helpers: @component_helpers,
47
59
  components_containing_components: find_all_partials_in(templates),
48
60
  component_listing: list_all_component_details,
49
61
  }
50
62
  end
51
63
 
52
- def find_files(files, replace)
64
+ def clean_files(files, replace)
53
65
  files.map { |file| clean_file_name(file.gsub(replace, "")) }.sort
54
66
  end
55
67
 
@@ -61,6 +73,7 @@ module GovukPublishingComponents
61
73
  .gsub(".js", "")
62
74
  .gsub("spec", "")
63
75
  .gsub(".rb", "")
76
+ .gsub("helper", "")
64
77
  .strip
65
78
  end
66
79
 
@@ -72,11 +85,14 @@ module GovukPublishingComponents
72
85
  .tr('\"\'', "")
73
86
  end
74
87
 
88
+ # create link to component guide page for a given component e.g. 'component name'
75
89
  def get_component_link(component)
76
90
  "/component-guide/#{component.gsub(' ', '_')}"
77
91
  end
78
92
 
79
93
  def find_all_partials_in(templates)
94
+ return [] if @simple
95
+
80
96
  components = []
81
97
 
82
98
  templates.each do |template|
@@ -142,6 +158,7 @@ module GovukPublishingComponents
142
158
  javascript: check_component_has("javascript", component),
143
159
  tests: check_component_has("test", component),
144
160
  js_tests: check_component_has("js_test", component),
161
+ helper: check_component_has("helper", component),
145
162
  }
146
163
  end
147
164
 
@@ -154,8 +171,28 @@ module GovukPublishingComponents
154
171
  look_in = @component_javascripts if a_thing == "javascript"
155
172
  look_in = @component_tests if a_thing == "test"
156
173
  look_in = @component_js_tests if a_thing == "js_test"
174
+ look_in = @component_helpers if a_thing == "helper"
175
+
176
+ if look_in.include?(component)
177
+ return get_asset_link(a_thing, component)
178
+ end
179
+
180
+ false
181
+ end
157
182
 
158
- true if look_in.include?(component)
183
+ def get_asset_link(a_thing, component)
184
+ url = "https://github.com/alphagov"
185
+ repo = "govuk_publishing_components"
186
+ blob = "blob/main"
187
+ link = nil
188
+ link = "#{url}/#{repo}/#{blob}/#{@stylesheets_path}/_#{component.gsub(' ', '-')}.scss" if a_thing == "stylesheet"
189
+ link = "#{url}/#{repo}/#{blob}/#{@print_stylesheets_path}/_#{component.gsub(' ', '-')}.scss" if a_thing == "print_stylesheet"
190
+ link = "#{url}/#{repo}/#{blob}/#{@javascripts_path}/#{component.gsub(' ', '-')}.js" if a_thing == "javascript"
191
+ link = "#{url}/#{repo}/#{blob}/#{@tests_path}/#{component.gsub(' ', '_')}_spec.rb" if a_thing == "test"
192
+ link = "#{url}/#{repo}/#{blob}/#{@js_tests_path}/#{component.gsub(' ', '-')}-spec.js" if a_thing == "js_test"
193
+ link = "#{url}/#{repo}/#{blob}/#{@helpers_path}/#{component.gsub(' ', '_')}_helper.rb" if a_thing == "helper"
194
+
195
+ link
159
196
  end
160
197
  end
161
198
  end
@@ -32,6 +32,7 @@
32
32
 
33
33
  <% accordion_content = capture do %>
34
34
  <% if application[:application_found] %>
35
+ <% github_link = 'https://github.com/alphagov/' + application[:name] + '/blob/main/' %>
35
36
  <% application[:warnings].each do |warning| %>
36
37
  <p class="govuk-body">
37
38
  <strong class="govuk-tag">Warn</strong>
@@ -74,7 +75,9 @@
74
75
  <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
76
  <ul class="govuk-list govuk-list--bullet">
76
77
  <% application[:gem_style_references].each do |ref| %>
77
- <li><%= ref %></li>
78
+ <li>
79
+ <%= link_to ref, github_link + ref, class: 'govuk-link' %>
80
+ </li>
78
81
  <% end %>
79
82
  </ul>
80
83
  <% end %>
@@ -86,10 +89,12 @@
86
89
  margin_bottom: 4,
87
90
  heading_level: 3,
88
91
  } %>
89
- <p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
92
+ <p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove.</p>
90
93
  <ul class="govuk-list govuk-list--bullet">
91
94
  <% application[:jquery_references].each do |ref| %>
92
- <li><%= ref %></li>
95
+ <li>
96
+ <%= link_to ref, github_link + ref, class: 'govuk-link' %>
97
+ </li>
93
98
  <% end %>
94
99
  </ul>
95
100
  <% end %>
@@ -0,0 +1,82 @@
1
+ <%
2
+ total_components = components.length
3
+ components_with_stylesheet = 0
4
+ components_with_print_stylesheet = 0
5
+ components_with_javascript = 0
6
+ components_with_test = 0
7
+ components_with_javascript_test = 0
8
+ components_with_helper = 0
9
+
10
+ components.each do |component|
11
+ components_with_stylesheet += 1 if component[:stylesheet]
12
+ components_with_print_stylesheet += 1 if component[:print_stylesheet]
13
+ components_with_javascript += 1 if component[:javascript]
14
+ components_with_test += 1 if component[:tests]
15
+ components_with_javascript_test += 1 if component[:js_tests]
16
+ components_with_helper += 1 if component[:helper]
17
+ end
18
+ %>
19
+ <table class="govuk-table">
20
+ <thead class="govuk-table__head">
21
+ <tr class="govuk-table__row">
22
+ <th scope="col" class="govuk-table__header sticky-table-header">Component (<%= total_components %>)</th>
23
+ <th scope="col" class="govuk-table__header sticky-table-header">CSS (<%= components_with_stylesheet %>)</th>
24
+ <th scope="col" class="govuk-table__header sticky-table-header">Print CSS (<%= components_with_print_stylesheet %>)</th>
25
+ <th scope="col" class="govuk-table__header sticky-table-header">JS (<%= components_with_javascript %>)</th>
26
+ <th scope="col" class="govuk-table__header sticky-table-header">Test (<%= components_with_test %>)</th>
27
+ <th scope="col" class="govuk-table__header sticky-table-header">JS test (<%= components_with_javascript_test %>)</th>
28
+ <th scope="col" class="govuk-table__header sticky-table-header">Helper (<%= components_with_helper %>)</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody class="govuk-table__body">
32
+ <% components.each do |component| %>
33
+ <tr class="govuk-table__row">
34
+ <th scope="row" class="govuk-table__header">
35
+ <a href="<%= component[:link] %>" class="govuk-link"><%= component[:name] %></a>
36
+ </th>
37
+ <td class="govuk-table__cell">
38
+ <% if component[:stylesheet] %>
39
+ <strong class="govuk-tag govuk-tag--green">
40
+ <a href="<%= component[:stylesheet] %>" class="govuk-link">Yes</a>
41
+ </strong>
42
+ <% end %>
43
+ </td>
44
+ <td class="govuk-table__cell">
45
+ <% if component[:print_stylesheet] %>
46
+ <strong class="govuk-tag govuk-tag--green">
47
+ <a href="<%= component[:print_stylesheet] %>" class="govuk-link">Yes</a>
48
+ </strong>
49
+ <% end %>
50
+ </td>
51
+ <td class="govuk-table__cell">
52
+ <% if component[:javascript] %>
53
+ <strong class="govuk-tag govuk-tag--green">
54
+ <a href="<%= component[:javascript] %>" class="govuk-link">Yes</a>
55
+ </strong>
56
+ <% end %>
57
+ </td>
58
+ <td class="govuk-table__cell">
59
+ <% if component[:tests] %>
60
+ <strong class="govuk-tag govuk-tag--green">
61
+ <a href="<%= component[:tests] %>" class="govuk-link">Yes</a>
62
+ </strong>
63
+ <% end %>
64
+ </td>
65
+ <td class="govuk-table__cell">
66
+ <% if component[:js_tests] %>
67
+ <strong class="govuk-tag govuk-tag--green">
68
+ <a href="<%= component[:js_tests] %>" class="govuk-link">Yes</a>
69
+ </strong>
70
+ <% end %>
71
+ </td>
72
+ <td class="govuk-table__cell">
73
+ <% if component[:helper] %>
74
+ <strong class="govuk-tag govuk-tag--green">
75
+ <a href="<%= component[:helper] %>" class="govuk-link">Yes</a>
76
+ </strong>
77
+ <% end %>
78
+ </td>
79
+ </tr>
80
+ <% end %>
81
+ </tbody>
82
+ </table>
@@ -1,6 +1,6 @@
1
1
  <% if @other_applications %>
2
2
  <%= render "govuk_publishing_components/components/heading", {
3
- text: "Components",
3
+ text: "Components in the gem",
4
4
  font_size: "l",
5
5
  margin_bottom: 6,
6
6
  } %>
@@ -10,52 +10,7 @@
10
10
  <% component_items = [] %>
11
11
 
12
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>
13
+ <%= render partial: "component_contents", locals: { components: @components[:component_listing] } %>
59
14
  <% end %>
60
15
 
61
16
  <%
@@ -20,7 +20,7 @@
20
20
  <p>Components are packages of template, style, behaviour and documentation that live in your application.</p>
21
21
  <p>See the <a href="https://github.com/alphagov/govuk_publishing_components">govuk_publishing_components gem</a> for further details, or <a href="https://docs.publishing.service.gov.uk/manual/components.html#component-guides">a list of all component guides</a>.</p>
22
22
  <ul>
23
- <li>Read about how to <a href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/publishing-to-rubygems.md">release a new version of the gem</a></li>
23
+ <li>Read about how to <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/publishing-to-rubygems.md">release a new version of the gem</a></li>
24
24
  <% if ENV["MAIN_COMPONENT_GUIDE"] %>
25
25
  <li><a href="/component-guide/audit">View component audits</a></li>
26
26
  <% end %>
@@ -105,5 +105,5 @@
105
105
  </ul>
106
106
 
107
107
  <div class="component-markdown">
108
- <p class="govuk-body">If you cannot find a suitable component consider extending an existing component or <a href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/generate-a-new-component.md">creating a new one</a>.</p>
108
+ <p class="govuk-body">If you cannot find a suitable component consider extending an existing component or <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/generate-a-new-component.md">creating a new one</a>.</p>
109
109
  </div>
@@ -13,7 +13,7 @@
13
13
  <% if !@component_doc.accessibility_criteria.present? %>
14
14
  <div class="component-violation">
15
15
  <h2 class="component-violation__title">This component is not valid</h2>
16
- <a class="component-violation__link" href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/accessibility_acceptance_criteria.md">Please define accessibility acceptance criteria for this component.</a>
16
+ <a class="component-violation__link" href="https://github.com/alphagov/govuk_publishing_components/blob/main/docs/accessibility_acceptance_criteria.md">Please define accessibility acceptance criteria for this component.</a>
17
17
  </div>
18
18
  <% end %>
19
19
  <%= render 'govuk_publishing_components/components/lead_paragraph', text: @component_doc.description %>
@@ -1,5 +1,5 @@
1
1
  <%
2
- attachment = GovukPublishingComponents::Presenters::Attachment.new(attachment)
2
+ attachment = GovukPublishingComponents::Presenters::AttachmentHelper.new(attachment)
3
3
  target ||= "_self"
4
4
  hide_opendocument_metadata ||= false
5
5
  hide_order_copy_link ||= false
@@ -1,5 +1,5 @@
1
1
  <%
2
- attachment = GovukPublishingComponents::Presenters::Attachment.new(attachment)
2
+ attachment = GovukPublishingComponents::Presenters::AttachmentHelper.new(attachment)
3
3
  target ||= nil
4
4
  data_attributes ||= {}
5
5
  attributes = []
@@ -31,17 +31,19 @@
31
31
  end
32
32
  %>
33
33
  <li class="gem-c-cards__list-item">
34
- <%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %>
35
- <%=
36
- link_to link[:text], link[:path],
37
- class: "govuk-link gem-c-cards__link",
38
- data: link[:data_attributes],
39
- "data-track-count": "cardLink"
40
- %>
41
- <% end %>
42
- <% if item[:description] %>
43
- <p class="govuk-body gem-c-cards__description"><%= item[:description] %></p>
44
- <% end %>
34
+ <div class="gem-c-cards__list-item-wrapper">
35
+ <%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %>
36
+ <%=
37
+ link_to link[:text], link[:path],
38
+ class: "govuk-link gem-c-cards__link",
39
+ data: link[:data_attributes],
40
+ "data-track-count": "cardLink"
41
+ %>
42
+ <% end %>
43
+ <% if item[:description] %>
44
+ <p class="govuk-body gem-c-cards__description"><%= item[:description] %></p>
45
+ <% end %>
46
+ </div>
45
47
  </li>
46
48
  <% end %>
47
49
  <% end %>
@@ -107,20 +107,19 @@
107
107
  <% if edit_link && delete_link %>
108
108
  <%= tag.dd class: "govuk-summary-list__actions" do %>
109
109
  <%= tag.ul class: "govuk-summary-list__actions-list" do %>
110
- <% if item.fetch(:edit, {}).any? %>
110
+ <% if edit_link %>
111
111
  <%= tag.li class: "govuk-summary-list__actions-list-item" do %>
112
112
  <%= edit_link %>
113
113
  <% end %>
114
114
  <% end %>
115
- <% if item.fetch(:delete, {}).any? %>
115
+ <% if delete_link %>
116
116
  <%= tag.li class: "govuk-summary-list__actions-list-item" do %>
117
117
  <%= delete_link %>
118
118
  <% end %>
119
119
  <% end %>
120
120
  <% end %>
121
121
  <% end %>
122
- <% else %>
123
- <% if edit_link || delete_link %>
122
+ <% elsif edit_link || delete_link %>
124
123
  <%= tag.dd class: "govuk-summary-list__actions" do %>
125
124
  <%= edit_link %>
126
125
  <%= delete_link %>
@@ -130,7 +129,7 @@
130
129
  <% end %>
131
130
  <% end %>
132
131
  <% end %>
133
- <% end %>
132
+
134
133
  <%= tag.div block, class: "gem-c-summary__block" if block %>
135
134
  <% end %>
136
135
  <% end %>
@@ -191,7 +191,7 @@ examples:
191
191
  context:
192
192
  right_to_left: true
193
193
  with_branding:
194
- description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) for more details.
194
+ description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) for more details.
195
195
  data:
196
196
  brand: 'department-for-environment-food-rural-affairs'
197
197
  format_numbers: true
@@ -2,7 +2,7 @@ name: Document list
2
2
  description: An ordered list of documents including a document type, when updated and a link.
3
3
  body: |
4
4
  Outputs a list to documents, based on an array of document data. A "document" in this context can be an asset (such as a ODT or other downloadable document) or a web page.
5
-
5
+
6
6
  The component can display:
7
7
 
8
8
  * a document title
@@ -116,7 +116,7 @@ examples:
116
116
  public_updated_at: 2017-07-19 15:01:48
117
117
  document_type: 'Statutory guidance'
118
118
  with_branding:
119
- description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) for more details.
119
+ description: Where this component could be used on an organisation page (such as the [Attorney General's Office](https://www.gov.uk/government/organisations/attorney-generals-office)) branding can be applied for link colours and border colours. See the [branding documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) for more details.
120
120
  data:
121
121
  brand: 'attorney-generals-office'
122
122
  items:
@@ -308,9 +308,9 @@ examples:
308
308
  with_rel_link_attribute:
309
309
  description: |
310
310
  The [rel attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel) is an option attribute to dictate the relationship between the document being linked to and the current page. This is predominantly used by search engines to help index journeys through a website.
311
-
311
+
312
312
  On GOV.UK, this is typically used to dictate an external website being linked to with `rel="external"`, however this component supports:
313
-
313
+
314
314
  - external
315
315
  - nofollow
316
316
  - noopener
@@ -65,7 +65,7 @@ examples:
65
65
  padding: true
66
66
  border_top: 2
67
67
  with_branding:
68
- description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) can be added to the component as shown, if a top border is included.
68
+ description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) can be added to the component as shown, if a top border is included.
69
69
  data:
70
70
  text: 'Branding'
71
71
  brand: 'department-for-environment-food-rural-affairs'
@@ -166,7 +166,7 @@ examples:
166
166
  heading_text: 'John McJohnson'
167
167
  description: 'Deputy director for Parks and Small Trees'
168
168
  with_branding:
169
- description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) can be added to the component as shown.
169
+ description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) can be added to the component as shown.
170
170
  data:
171
171
  brand: "department-for-work-pensions"
172
172
  href: "/again-not-a-page"
@@ -4,9 +4,9 @@ body: |
4
4
  This takes a content-store links hash like object which it can then turn into
5
5
  the correct analytics identifier metadata tags.
6
6
 
7
- These are additionally used by the <a href="https://github.com/alphagov/govuk-browser-extension">GOV.UK browser extension</a> to provide details about a given page.
7
+ These are additionally used by the <a href="https://github.com/alphagov/govuk-browser-extension">GOV.UK browser extension</a> to provide details about a given page.
8
8
 
9
- The code which reads the meta tags can be found <a href="https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js">in custom-dimensions.js</a>.
9
+ The code which reads the meta tags can be found <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js">in custom-dimensions.js</a>.
10
10
  accessibility_criteria: |
11
11
  The analytics meta tags component should not be visible to any users.
12
12
  display_html: true
@@ -24,7 +24,7 @@ examples:
24
24
  with_content_history_tags:
25
25
  description: |
26
26
  The tags in this object will generate the `content-has-history` tag, set to true. This tag is triggered when either, within `content_item`:
27
-
27
+
28
28
  1. `public_updated_at` and `first_public_at` within `details` are both present and they aren't the same value
29
29
  2. `change_history` within `details` is present and it has a value of more than 1
30
30
 
@@ -121,4 +121,4 @@ examples:
121
121
  content_item:
122
122
  links:
123
123
  secondary_to_step_navs:
124
- - content_id: "22222222-2222-2222-2222-222222222222"
124
+ - content_id: "22222222-2222-2222-2222-222222222222"
@@ -359,7 +359,7 @@ examples:
359
359
  dark_background: true
360
360
  with_custom_margin_bottom:
361
361
  description: |
362
- The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to the `margin-bottom` values defined in the [responsive-bottom-margin mixin](https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss#L1)
362
+ The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to the `margin-bottom` values defined in the [responsive-bottom-margin mixin](https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss#L1)
363
363
  data:
364
364
  first_published: 14 June 2014
365
365
  last_updated: 10 September 2015
@@ -80,7 +80,7 @@ examples:
80
80
  }
81
81
  ]
82
82
  with_branding:
83
- description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) can be added to the component as shown.
83
+ description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) can be added to the component as shown.
84
84
  data:
85
85
  brand: 'attorney-generals-office'
86
86
  links: [
@@ -46,7 +46,7 @@ examples:
46
46
  email_signup_link: '/foreign-travel-advice/singapore/email-signup'
47
47
  feed_link_box_value: 'https://www.gov.uk/government/organisations/attorney-generals-office.atom'
48
48
  with_branding:
49
- description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) can be added to the component as shown.
49
+ description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) can be added to the component as shown.
50
50
  data:
51
51
  brand: 'attorney-generals-office'
52
52
  email_signup_link: '/foreign-travel-advice/singapore/email-signup'