govuk_publishing_components 38.3.0 → 38.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a962544f5f3b684f7f946008d73fc0c4d266147adeb86761b2fafbdf9f77713
4
- data.tar.gz: 3c14a82d4308f941d8dc7ac0990c8a504b1ada7dcd84666b2140a4bcdba01b79
3
+ metadata.gz: b4722ee8913bce56729719e8dde26b88d7958e23fd8c6177a12bcfb67b91a0c6
4
+ data.tar.gz: 77afa0a3c76a84f04523dbd435d18dc92feb1615a106efe301e3e9e78f743c69
5
5
  SHA512:
6
- metadata.gz: 2b237ac3408f80f1fd42d810e48a8d30e164d0fbd61b0e1e8314bf16d4b6e17809a0d3dc5a0c4ee4dbb4369a80f402244ed5ff6201779426e02e459c416567fe
7
- data.tar.gz: 7c74c53993d223235c04646f52f5e894f077486ce04d7cf82ddedf73b3e0800d225ea69b75cb0516a6bdfa0c6bdabe1690594aef0643d55b1c1b88cc8db98960
6
+ metadata.gz: 8861808afb26f285beb8cf3c8a91bd19a7cf076b44a784bf6da5167e24e10c643eb744bd5c0b87cbaf65c358d525a81441fd25d477e14c16b7233428b2fd7e61
7
+ data.tar.gz: 4baa708a0bede0ac54705a63d0fc2bc2a8d957ccae3d4b59b35e2dd8fa75ce62db1e4a7b0c4f6bedbf3c3e1751878732112b0fef1beba648a2a5d4a3abf5287b
@@ -26,7 +26,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
26
26
  Feedback.prototype.init = function () {
27
27
  this.setInitialAriaAttributes()
28
28
  this.setHiddenValues()
29
-
29
+ this.setSurveyPath()
30
30
  this.prompt.hidden = false
31
31
  for (var k = 0; k < this.promptQuestions.length; k++) {
32
32
  this.promptQuestions[k].hidden = false
@@ -151,6 +151,21 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
151
151
  this.somethingIsWrongForm.appendChild(this.timerHoneyPot)
152
152
  }
153
153
 
154
+ // This getter is needed for spyOn in tests
155
+ Feedback.prototype.getPagePath = function () {
156
+ return window.location.pathname
157
+ }
158
+
159
+ Feedback.prototype.setSurveyPath = function () {
160
+ var surveyLink = this.$module.querySelector('#survey_explanation a')
161
+
162
+ if (surveyLink) {
163
+ var pathWithoutEmailPII = this.getPagePath().replace(/[^\s=?&]+(?:@|%40)[^\s=?&]+/, '[email]')
164
+ var encodedPath = encodeURI(pathWithoutEmailPII)
165
+ surveyLink.setAttribute('href', 'https://www.smartsurvey.co.uk/s/gov-uk-banner/?c=' + encodedPath)
166
+ }
167
+ }
168
+
154
169
  Feedback.prototype.updateAriaAttributes = function (linkClicked) {
155
170
  linkClicked.setAttribute('aria-expanded', true)
156
171
  }
@@ -161,8 +176,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
161
176
  this.prompt.hidden ? this.prompt.hidden = false : this.prompt.hidden = true
162
177
 
163
178
  if (!this.activeForm.hidden) {
164
- this.activeForm.querySelectorAll('.gem-c-textarea .govuk-textarea, .gem-c-input.govuk-input')[0]
165
- .focus()
179
+ var input = this.activeForm.querySelectorAll('.gem-c-textarea .govuk-textarea, .gem-c-input.govuk-input')
180
+ if (input.length > 0) {
181
+ input[0].focus()
182
+ }
166
183
  } else {
167
184
  this.activeForm = false
168
185
  clearInterval(this.timerInterval)
@@ -10,7 +10,7 @@
10
10
  <h3 class="gem-c-feedback__form-heading"><%= t("components.feedback.help_us_improve_govuk") %></h3>
11
11
  <p id="survey_explanation" class="gem-c-feedback__form-paragraph">
12
12
  <%= t("components.feedback.more_about_visit") %>
13
- <a href="https://www.smartsurvey.co.uk/s/gov-uk-banner/?c=<%= path_without_pii %>" class="govuk-link">Please fill in this survey</a>.
13
+ <a href="https://www.smartsurvey.co.uk/s/gov-uk-banner/?c=no-js" class="govuk-link" target="_blank" rel="noopener noreferrer external">Please fill in this survey (opens in a new tab)</a>.
14
14
  </p>
15
15
  <button
16
16
  class="govuk-button govuk-button--secondary js-close-form"
@@ -7,7 +7,7 @@
7
7
  end
8
8
  %>
9
9
  <% if remaining.any? %>
10
- <%= items.to_sentence(last_word_connector: ', ').html_safe %>
10
+ <%= items.to_sentence(last_word_connector: ' and ').html_safe %>
11
11
  <div class="gem-c-metadata__toggle-wrap govuk-!-display-none-print">
12
12
  <a href="#"
13
13
  class="gem-c-metadata__definition-link govuk-!-display-none-print"
@@ -21,5 +21,5 @@
21
21
  </div>
22
22
  <span id="toggle-<%= toggle_id %>" class="gem-c-metadata__toggle-items js-hidden"><%= remaining.to_sentence.html_safe %></span>
23
23
  <% else %>
24
- <%= items.to_sentence.html_safe %>
24
+ <%= items.to_sentence(last_word_connector: ' and ').html_safe %>
25
25
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "38.3.0".freeze
2
+ VERSION = "38.3.2".freeze
3
3
  end
@@ -103,9 +103,9 @@ or equivalently:
103
103
 
104
104
  This will create a new build for axe, called `axe.<lang>.js` and `axe.<lang>.min.js`. If you want to build all localized versions, simply pass in `--all-lang` instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of languages to the `--lang` flag, like `--lang=nl,ja`.
105
105
 
106
- To create a new translation for axe, start by running `grunt translate --lang=<langcode>`. This will create a json file fin the `./locales` directory, with the default English text in it for you to translate. Alternatively, you could copy `./locales/_template.json`. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see [Check Message Template](/doc/check-message-template.md).
106
+ To create a new translation for axe, start by running `grunt translate --lang=<langcode>`. This will create a json file in the `./locales` directory, with the default English text in it for you to translate. Alternatively, you could copy `./locales/_template.json`. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see [Check Message Template](/doc/check-message-template.md).
107
107
 
108
- To update existing translation file, re-run `grunt translate --lang=<langcode>`. This will add new messages used in English and remove messages which were not used in English.
108
+ To update an existing translation file, re-run `grunt translate --lang=<langcode>`. This will add new messages used in English and remove messages which were not used in English.
109
109
 
110
110
  Additionally, locale can be applied at runtime by passing a `locale` object to `axe.configure()`. The locale object must be of the same shape as existing locales in the `./locales` directory. For example:
111
111