govuk_publishing_components 28.6.0 → 28.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +3 -3
  4. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +7 -6
  5. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +1796 -911
  6. data/app/models/govuk_publishing_components/component_docs.rb +4 -1
  7. data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -1
  8. data/app/views/govuk_publishing_components/components/_button.html.erb +3 -3
  9. data/app/views/govuk_publishing_components/components/_input.html.erb +3 -3
  10. data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -2
  11. data/app/views/govuk_publishing_components/components/_search.html.erb +2 -4
  12. data/app/views/govuk_publishing_components/components/_select.html.erb +15 -43
  13. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +7 -8
  14. data/app/views/govuk_publishing_components/components/docs/attachment.yml +11 -0
  15. data/app/views/govuk_publishing_components/components/docs/select.yml +1 -1
  16. data/config/initializers/assets.rb +1 -0
  17. data/lib/govuk_publishing_components/presenters/attachment.rb +23 -0
  18. data/lib/govuk_publishing_components/presenters/select_helper.rb +85 -0
  19. data/lib/govuk_publishing_components/version.rb +1 -1
  20. data/lib/govuk_publishing_components.rb +1 -1
  21. metadata +7 -37
  22. data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +0 -100
  23. data/lib/govuk_publishing_components/presenters/select.rb +0 -43
  24. data/lib/tasks/govuk_publishing_components_tasks.rake +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85985bab4532c5cbccfa05369e032e61cedfda7468ab5654d10ce0eb937155b8
4
- data.tar.gz: fd00b4c1e0784b1951f0103412dc7dd2eaf619d2ad72456c77b892903fc1cd9a
3
+ metadata.gz: 56d5f41976b37b95a3d00db9c7375f7d500879dc0715134227b7f3e935b88ecf
4
+ data.tar.gz: debdecb330a017f20cabbdc4a2635709f3101a1c9ab7c95043a4cf12283258e8
5
5
  SHA512:
6
- metadata.gz: fd73aa7768ba4224e03065bb8b04becf3e4c227c50422eb5255ab52fe82a075a8e5968d143ecb80bbc3f3481432783ab1ef7dad55515801f2905c2449676989d
7
- data.tar.gz: 6b0541c15147aedcbbd890cb222d280ba02f492fb84d5a280580b5fa6d64a58f6e5a80ae2277bd9667e3e9c7a9c28b22ba2ef590400b5b047230cb3e0036f41b
6
+ metadata.gz: 1a27ffd2c2449ac670a5726512a140d379cd960371107afe40a4d563a3d15f054280a23dbd01acbd2734047628b91d1b2baee7d7405c680ba87122a1b4c5cc6f
7
+ data.tar.gz: 1a8d05393b71c257a6dc2af490515a61ce5680aec77ba96b16bd0e4cd64b7ced87be26d9db70f1315426f9b71687c0ac06bf7897c3409968a11f9be40e89c847
data/README.md CHANGED
@@ -29,10 +29,10 @@ To run JavaScript tests (only):
29
29
 
30
30
  ```sh
31
31
  # run JS tests in browser
32
- bin/rake app:jasmine
32
+ yarn run jasmine:browser
33
33
 
34
34
  # run JS tests on command line
35
- bin/rake app:jasmine:ci
35
+ yarn run jasmine:ci
36
36
  ```
37
37
 
38
38
  ### Further documentation
@@ -14,7 +14,7 @@
14
14
  case isDocumentCollectionPage():
15
15
  return document.querySelectorAll('.document-collection .group-title').length
16
16
  case isMainstreamBrowsePage():
17
- return countVisible(document.querySelectorAll('#subsection ul')) || document.querySelectorAll('#section ul').length
17
+ return countVisible(document.querySelectorAll('#subsection ul')) || document.querySelectorAll('#section ul').length || document.querySelectorAll('#root ul').length
18
18
  case isTopicPage():
19
19
  return document.querySelectorAll('.topics-page nav.index-list').length
20
20
  case isPolicyAreaPage():
@@ -45,7 +45,7 @@
45
45
  case isDocumentCollectionPage():
46
46
  return document.querySelectorAll('.document-collection .group-document-list li a').length
47
47
  case isMainstreamBrowsePage():
48
- return countVisible(document.querySelectorAll('#subsection ul a')) || document.querySelectorAll('#section ul a').length
48
+ return countVisible(document.querySelectorAll('#subsection ul a')) || document.querySelectorAll('#section ul a').length || document.querySelectorAll('#root ul a').length
49
49
  case isTopicPage():
50
50
  return document.querySelectorAll('.topics-page .index-list ul a').length ||
51
51
  document.querySelectorAll('.topics-page .topics ul a').length
@@ -71,7 +71,7 @@
71
71
  function getMetaAttribute (selector) {
72
72
  var element = document.querySelector(selector)
73
73
  if (element) {
74
- return element.getAttribute('content')
74
+ return element.getAttribute('content').toLowerCase()
75
75
  }
76
76
  }
77
77
 
@@ -87,22 +87,23 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
87
87
  var params = new FormData($form)
88
88
  params = new URLSearchParams(params).toString()
89
89
 
90
- xhr.open('POST', url, true)
91
- xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
92
-
93
- xhr.onreadystatechange = function () {
94
- if (xhr.readyState === 4 && xhr.status === 200) {
90
+ this.done = function () {
91
+ if (xhr.status === 200) {
95
92
  this.trackEvent(this.getTrackEventParams($form))
96
93
  this.showFormSuccess(xhr.message)
97
94
  this.revealInitialPrompt()
98
95
  this.setInitialAriaAttributes()
99
- this.activeForm.hidden ? this.activeForm.hidden = false : this.activeForm.hidden = true
96
+ this.activeForm.hidden = true
100
97
  } else {
101
98
  this.showError(xhr)
102
99
  this.enableSubmitFormButton($form)
103
100
  }
104
101
  }.bind(this)
105
102
 
103
+ xhr.addEventListener('loadend', this.done)
104
+ xhr.open('POST', url, true)
105
+ xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
106
+
106
107
  this.disableSubmitFormButton($form)
107
108
  xhr.send(params)
108
109
  }.bind(this))