govuk_publishing_components 24.0.0 → 24.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +28 -0
  3. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +330 -4
  4. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +26 -6
  5. data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js +8 -0
  6. data/app/assets/stylesheets/component_guide/application.scss +0 -8
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +298 -14
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +11 -84
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +21 -5
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +17 -13
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +4 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +17 -9
  13. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +1 -11
  14. data/app/models/govuk_publishing_components/audit_applications.rb +2 -2
  15. data/app/models/govuk_publishing_components/audit_comparer.rb +2 -2
  16. data/app/models/govuk_publishing_components/component_example.rb +4 -3
  17. data/app/views/govuk_publishing_components/audit/show.html.erb +211 -199
  18. data/app/views/govuk_publishing_components/components/_accordion.html.erb +15 -22
  19. data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -3
  20. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  21. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +50 -39
  23. data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +1 -1
  24. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
  25. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +1 -1
  26. data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
  27. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +1 -1
  28. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +1 -1
  29. data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -1
  30. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -1
  31. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
  32. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -1
  33. data/app/views/govuk_publishing_components/components/_taxonomy_list.html.erb +1 -1
  34. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/attachment/{_thumbnail_document.svg → _thumbnail_document.html.erb} +0 -0
  36. data/app/views/govuk_publishing_components/components/attachment/{_thumbnail_generic.svg → _thumbnail_generic.html.erb} +0 -0
  37. data/app/views/govuk_publishing_components/components/attachment/{_thumbnail_spreadsheet.svg → _thumbnail_spreadsheet.html.erb} +0 -0
  38. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +1 -1
  39. data/app/views/govuk_publishing_components/components/docs/accordion.yml +37 -3
  40. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +9 -0
  41. data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +1 -1
  42. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  43. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +2 -0
  44. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +2 -2
  45. data/lib/govuk_publishing_components/app_helpers/table_helper.rb +2 -1
  46. data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +1 -1
  47. data/lib/govuk_publishing_components/presenters/machine_readable/html_publication_schema.rb +1 -7
  48. data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -2
  49. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +2 -2
  50. data/lib/govuk_publishing_components/version.rb +1 -1
  51. data/lib/tasks/govuk_publishing_components_tasks.rake +1 -1
  52. metadata +11 -10
@@ -45,7 +45,7 @@ examples:
45
45
  data:
46
46
  padding_top: false
47
47
  block: |
48
- <div class="gem-c-breadcrumbs " data-module="track-click">
48
+ <div class="gem-c-breadcrumbs " data-module="gem-track-click">
49
49
  <ol>
50
50
  <li class="">
51
51
  <a data-track-category="breadcrumbClicked" data-track-action="1" data-track-label="/section" data-track-options="{&quot;dimension28&quot;:&quot;2&quot;,&quot;dimension29&quot;:&quot;Section&quot;}" class="gem-c-breadcrumbs--inverse" aria-current="false" href="/section">Section</a>
@@ -1,5 +1,5 @@
1
1
  <div class="govuk-header__logo gem-c-header__logo">
2
- <a href="/" class="govuk-header__link govuk-header__link--homepage" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
2
+ <a href="/" class="govuk-header__link govuk-header__link--homepage" data-module="gem-track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
3
3
  <span class="govuk-header__logotype">
4
4
  <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36">
5
5
  <path fill="currentColor" fill-rule="evenodd"
@@ -1,3 +1,5 @@
1
+ <% navigation_aria_label ||= "Top level" %>
2
+
1
3
  <% if navigation_items.any? %>
2
4
  <button role="button" class="govuk-header__menu-button gem-c-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide Top Level Navigation">Menu</button>
3
5
  <%= tag.nav class: "gem-c-header__nav", aria: { label: navigation_aria_label } do %>
@@ -16,7 +16,7 @@
16
16
  %>
17
17
  <% end %>
18
18
 
19
- <ul class="gem-c-related-navigation__link-list" data-module="track-click">
19
+ <ul class="gem-c-related-navigation__link-list" data-module="gem-track-click">
20
20
  <% constructed_link_array = [] %>
21
21
 
22
22
  <% section_link_limit = related_nav_helper.calculate_section_link_limit(links) %>
@@ -26,7 +26,7 @@
26
26
  link_element = link_to(
27
27
  link[:text],
28
28
  link[:path],
29
- class: related_nav_helper.section_css_class("gem-c-related-navigation__section-link", section_title, link, (index >= section_link_limit)),
29
+ class: related_nav_helper.section_css_class("gem-c-related-navigation__section-link", section_title, link: link, link_is_inline: (index >= section_link_limit)),
30
30
  rel: link[:rel],
31
31
  lang: shared_helper.t_locale_check(link[:locale]),
32
32
  data: {
@@ -15,6 +15,7 @@ module GovukPublishingComponents
15
15
  yield(builder)
16
16
  end
17
17
  end
18
+
18
19
  class TableBuilder
19
20
  include ActionView::Helpers::UrlHelper
20
21
  include ActionView::Helpers::TagHelper
@@ -57,7 +58,7 @@ module GovukPublishingComponents
57
58
 
58
59
  def cell(str, opt = {})
59
60
  classes = %w[govuk-table__cell]
60
- classes << "govuk-table__cell--" + opt[:format] if opt[:format]
61
+ classes << "govuk-table__cell--#{opt[:format]}" if opt[:format]
61
62
  classes << "govuk-table__cell--empty" unless str
62
63
  str ||= "Not set"
63
64
  tag.td str, class: classes
@@ -88,7 +88,7 @@ module GovukPublishingComponents
88
88
  end
89
89
 
90
90
  def section_url(anchor)
91
- return page_url + "#" + anchor if anchor.present?
91
+ return "#{page_url}##{anchor}" if anchor.present?
92
92
 
93
93
  page_url
94
94
  end
@@ -1,12 +1,6 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class HtmlPublicationSchema < FaqPageSchema
4
- attr_reader :page
5
-
6
- def initialize(page)
7
- @page = page
8
- end
9
-
10
4
  def structured_data
11
5
  return ArticleSchema.new(page).structured_data if less_than_two_headings_of_any_one_type?
12
6
 
@@ -55,7 +49,7 @@ module GovukPublishingComponents
55
49
  # {:a => :b, :b => :c}
56
50
  def pairs_hash(array)
57
51
  all_but_last = array[0..-2]
58
- all_but_first = array[1..-1]
52
+ all_but_first = array[1..]
59
53
  pairs = [all_but_last, all_but_first].transpose
60
54
  Hash[pairs]
61
55
  end
@@ -20,8 +20,7 @@ module GovukPublishingComponents
20
20
  meta_tags = add_organisation_tags(meta_tags)
21
21
  meta_tags = add_political_tags(meta_tags)
22
22
  meta_tags = add_taxonomy_tags(meta_tags)
23
- meta_tags = add_step_by_step_tags(meta_tags)
24
- meta_tags
23
+ add_step_by_step_tags(meta_tags)
25
24
  end
26
25
 
27
26
  private
@@ -58,14 +58,14 @@ module GovukPublishingComponents
58
58
  I18n.t(
59
59
  "components.related_#{@context}_navigation." + section_title,
60
60
  default: [
61
- I18n.t("components.related_navigation." + section_title),
61
+ I18n.t("components.related_navigation.#{section_title}"),
62
62
  section_title.tr("_", " "),
63
63
  ],
64
64
  )
65
65
  end
66
66
  end
67
67
 
68
- def section_css_class(css_class, section_title, link = {}, link_is_inline = false)
68
+ def section_css_class(css_class, section_title, link: {}, link_is_inline: false)
69
69
  css_classes = [css_class]
70
70
  css_classes << "#{css_class}--#{@context}" unless @context.nil?
71
71
  css_classes << "#{css_class}--inline" if link_is_inline
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "24.0.0".freeze
2
+ VERSION = "24.3.1".freeze
3
3
  end
@@ -14,7 +14,7 @@ namespace :component do
14
14
 
15
15
  if components_missing_docs.any?
16
16
  error = "You have components which are missing documentation. These components will not be displayed in the component guide:\n"
17
- components_missing_docs.each { |component| error += "\t" + component + "\n" }
17
+ components_missing_docs.each { |component| error += "\t#{component}\n" }
18
18
  error += "\n"
19
19
  raise NotImplementedError, error
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 24.0.0
4
+ version: 24.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -238,16 +238,16 @@ dependencies:
238
238
  name: rubocop-govuk
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - "~>"
241
+ - - '='
242
242
  - !ruby/object:Gem::Version
243
- version: '3'
243
+ version: 4.0.0.pre.1
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - "~>"
248
+ - - '='
249
249
  - !ruby/object:Gem::Version
250
- version: '3'
250
+ version: 4.0.0.pre.1
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: sassc-rails
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -453,6 +453,7 @@ files:
453
453
  - app/assets/javascripts/govuk_publishing_components/vendor/json2.js
454
454
  - app/assets/javascripts/govuk_publishing_components/vendor/modernizr.js
455
455
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js
456
+ - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js
456
457
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js
457
458
  - app/assets/stylesheets/component_guide/application.scss
458
459
  - app/assets/stylesheets/component_guide/print.scss
@@ -673,9 +674,9 @@ files:
673
674
  - app/views/govuk_publishing_components/components/_title.html.erb
674
675
  - app/views/govuk_publishing_components/components/_translation_nav.html.erb
675
676
  - app/views/govuk_publishing_components/components/_warning_text.html.erb
676
- - app/views/govuk_publishing_components/components/attachment/_thumbnail_document.svg
677
- - app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.svg
678
- - app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.svg
677
+ - app/views/govuk_publishing_components/components/attachment/_thumbnail_document.html.erb
678
+ - app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.html.erb
679
+ - app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb
679
680
  - app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb
680
681
  - app/views/govuk_publishing_components/components/docs/accordion.yml
681
682
  - app/views/govuk_publishing_components/components/docs/action_link.yml
@@ -1859,7 +1860,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1859
1860
  requirements:
1860
1861
  - - ">="
1861
1862
  - !ruby/object:Gem::Version
1862
- version: '0'
1863
+ version: '2.6'
1863
1864
  required_rubygems_version: !ruby/object:Gem::Requirement
1864
1865
  requirements:
1865
1866
  - - ">="