govuk_publishing_components 35.6.0 → 35.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/component_guide/audit-filter.js +45 -0
  3. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +206 -114
  4. data/app/assets/stylesheets/component_guide/application.scss +0 -25
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +5 -9
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +4 -0
  7. data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +37 -49
  8. data/app/views/govuk_publishing_components/audit/show.html.erb +2 -1
  9. data/app/views/govuk_publishing_components/components/_attachment.html.erb +38 -18
  10. data/app/views/govuk_publishing_components/components/_character_count.html.erb +4 -2
  11. data/app/views/govuk_publishing_components/components/_document_list.html.erb +8 -7
  12. data/app/views/govuk_publishing_components/components/_feedback.html.erb +1 -0
  13. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +9 -2
  14. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -0
  15. data/app/views/govuk_publishing_components/components/_metadata.html.erb +20 -14
  16. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -0
  17. data/app/views/govuk_publishing_components/components/_search.html.erb +1 -0
  18. data/app/views/govuk_publishing_components/components/_select.html.erb +1 -0
  19. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +2 -2
  20. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_document.html.erb +1 -1
  21. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_html.html.erb +3 -0
  23. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb +1 -1
  24. data/app/views/govuk_publishing_components/components/docs/attachment.yml +21 -0
  25. data/app/views/govuk_publishing_components/components/docs/document_list.yml +17 -0
  26. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +6 -0
  27. data/app/views/layouts/govuk_publishing_components/application.html.erb +23 -20
  28. data/config/locales/ar.yml +1 -0
  29. data/config/locales/az.yml +1 -0
  30. data/config/locales/be.yml +1 -0
  31. data/config/locales/bg.yml +1 -0
  32. data/config/locales/bn.yml +1 -0
  33. data/config/locales/cs.yml +1 -0
  34. data/config/locales/cy.yml +1 -0
  35. data/config/locales/da.yml +1 -0
  36. data/config/locales/de.yml +1 -0
  37. data/config/locales/dr.yml +1 -0
  38. data/config/locales/el.yml +1 -0
  39. data/config/locales/en.yml +1 -0
  40. data/config/locales/es-419.yml +1 -0
  41. data/config/locales/es.yml +1 -0
  42. data/config/locales/et.yml +1 -0
  43. data/config/locales/fa.yml +1 -0
  44. data/config/locales/fi.yml +1 -0
  45. data/config/locales/fr.yml +1 -0
  46. data/config/locales/gd.yml +1 -0
  47. data/config/locales/gu.yml +1 -0
  48. data/config/locales/he.yml +1 -0
  49. data/config/locales/hi.yml +1 -0
  50. data/config/locales/hr.yml +1 -0
  51. data/config/locales/hu.yml +1 -0
  52. data/config/locales/hy.yml +1 -0
  53. data/config/locales/id.yml +1 -0
  54. data/config/locales/is.yml +1 -0
  55. data/config/locales/it.yml +1 -0
  56. data/config/locales/ja.yml +1 -0
  57. data/config/locales/ka.yml +1 -0
  58. data/config/locales/kk.yml +1 -0
  59. data/config/locales/ko.yml +1 -0
  60. data/config/locales/lt.yml +1 -0
  61. data/config/locales/lv.yml +1 -0
  62. data/config/locales/ms.yml +1 -0
  63. data/config/locales/mt.yml +1 -0
  64. data/config/locales/nl.yml +1 -0
  65. data/config/locales/no.yml +1 -0
  66. data/config/locales/pa-pk.yml +1 -0
  67. data/config/locales/pa.yml +1 -0
  68. data/config/locales/pl.yml +1 -0
  69. data/config/locales/ps.yml +1 -0
  70. data/config/locales/pt.yml +1 -0
  71. data/config/locales/ro.yml +1 -0
  72. data/config/locales/ru.yml +1 -0
  73. data/config/locales/si.yml +1 -0
  74. data/config/locales/sk.yml +1 -0
  75. data/config/locales/sl.yml +1 -0
  76. data/config/locales/so.yml +1 -0
  77. data/config/locales/sq.yml +1 -0
  78. data/config/locales/sr.yml +1 -0
  79. data/config/locales/sv.yml +1 -0
  80. data/config/locales/sw.yml +1 -0
  81. data/config/locales/ta.yml +1 -0
  82. data/config/locales/th.yml +1 -0
  83. data/config/locales/tk.yml +1 -0
  84. data/config/locales/tr.yml +1 -0
  85. data/config/locales/uk.yml +1 -0
  86. data/config/locales/ur.yml +1 -0
  87. data/config/locales/uz.yml +1 -0
  88. data/config/locales/vi.yml +1 -0
  89. data/config/locales/zh-hk.yml +1 -0
  90. data/config/locales/zh-tw.yml +1 -0
  91. data/config/locales/zh.yml +1 -0
  92. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +5 -1
  93. data/lib/govuk_publishing_components/presenters/attachment_helper.rb +15 -3
  94. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +5 -0
  95. data/lib/govuk_publishing_components/version.rb +1 -1
  96. data/node_modules/axe-core/README.md +4 -0
  97. data/node_modules/axe-core/axe.js +25 -19
  98. data/node_modules/axe-core/axe.min.js +2 -2
  99. data/node_modules/axe-core/package.json +1 -1
  100. data/node_modules/axe-core/sri-history.json +4 -0
  101. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61fa79cdba028670638393c805fd3cb9ebff6ea2d03f4b4fdff7e973e1b86aae
4
- data.tar.gz: 2c82ee33f9cfaf8e920777530ad7da376b113fca3b02f741eb993712fac4a4aa
3
+ metadata.gz: fb44475cd33bb952348a502c37c3efd863abe1725c3eb74e52542b84c333c2b5
4
+ data.tar.gz: 9625af4c341034a1a2b3f690ef08c286baaf740f5aaf972d7f8da5259d90487b
5
5
  SHA512:
6
- metadata.gz: 0d766ce3ff5f8236b098a2ce61b6c0ccdd4039393168bf25c0128919563f8113792da9adcef6e0edbec2af19382f4db18f405edb402fa2598c2df49ff4288335
7
- data.tar.gz: 6c13cdf892754b1b55834d950e3dad1aeceb138cdb76e509b785d381721e78747db2c51070859829d9d8e348a0f2fa4fe7beb4498f55a761a397d0659206a94a
6
+ metadata.gz: e4ef66116738fae07573951c81aad049cb817f05c525ad987c2060f4617583a7858d9cc01a085d3c9a18a20d6c768fe319754e6885046194ca0bb85c98de5454
7
+ data.tar.gz: 55cebac0cd80a787a1e057cb671ea33b1e0c9e8da029472ba9b1518cf46cc6a0bdd1bf9e15bedf91107e8ec365a703809498cd6bec9be896fddf55283427a0d0
@@ -5,6 +5,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
5
5
  function AuditFilter ($module) {
6
6
  this.module = $module
7
7
  this.data = this.module.querySelector('[data-audit-list]')
8
+ this.headings = this.module.querySelector('[data-audit-headings]')
8
9
  }
9
10
 
10
11
  AuditFilter.prototype.init = function () {
@@ -14,6 +15,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
14
15
 
15
16
  this.filterComponentsFunction = this.filterComponents.bind(this)
16
17
  this.select.addEventListener('change', this.filterComponentsFunction)
18
+ this.setHeadingCount()
17
19
  }
18
20
  }
19
21
 
@@ -75,6 +77,49 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
75
77
  }
76
78
  }
77
79
  }
80
+ this.setHeadingCount()
81
+ }
82
+
83
+ AuditFilter.prototype.setHeadingCount = function () {
84
+ if (this.headings) {
85
+ var visibleRows = this.data.querySelectorAll('[data-application]:not([hidden])')
86
+
87
+ if (!this.headingLabels) {
88
+ this.headingLabels = this.getHeadingLabels()
89
+ }
90
+ // need an array of zeroes same length as headingLabels to store the counts
91
+ var headingCounts = new Array(this.headingLabels.length)
92
+ for (var i = 0; i < this.headingLabels.length; ++i) {
93
+ headingCounts[i] = 0
94
+ }
95
+
96
+ for (var j = 0; j < visibleRows.length; j++) {
97
+ for (var k = 0; k < this.headingLabels.length; k++) {
98
+ var cell = visibleRows[j].querySelector('[data-component-type=' + this.headingLabels[k] + ']')
99
+ if (cell.textContent.trim().length) {
100
+ headingCounts[k] += 1
101
+ }
102
+ }
103
+ }
104
+
105
+ var reg = /\([0-9]+\)/i
106
+ for (var l = 0; l < this.headingLabels.length; l++) {
107
+ var headingItem = this.headings.querySelector('[data-component-type=' + this.headingLabels[l] + ']')
108
+ headingItem.textContent = headingItem.textContent.replace(reg, '') + ' (' + headingCounts[l] + ')'
109
+ }
110
+ }
111
+ }
112
+
113
+ AuditFilter.prototype.getHeadingLabels = function () {
114
+ var headings = this.headings.querySelectorAll('[data-component-type]')
115
+ var labels = []
116
+ for (var i = 0; i < headings.length; i++) {
117
+ var label = headings[i].getAttribute('data-component-type')
118
+ if (labels.indexOf(label) === -1) {
119
+ labels.push(label)
120
+ }
121
+ }
122
+ return labels
78
123
  }
79
124
 
80
125
  Modules.AuditFilter = AuditFilter