govuk_publishing_components 38.3.1 → 38.4.0

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: 174edc8aff1507967b48ea3efcec2a79d56c22adbf64f5414d2d758603fb0ef5
4
- data.tar.gz: 0ce85ca601099c9341c2e956fef04e5fb1dbea78ffdc298a997e287423d21c8e
3
+ metadata.gz: e7ea0b6a93379ec1e7cb8e5b7194c5cc16e237129cdbe224b9a099d79f4ca7ff
4
+ data.tar.gz: 567e2f625bd4b773a48f56c13c15d383f4fcdba5c44c9369ae327b8cf5772419
5
5
  SHA512:
6
- metadata.gz: d47f8dd957ff9d95f2c118aa7d747e4c43ef7dbf95dc80636d6c2583e925235370ca0f246d1be53bb83bf8bf90633e46e859c79fadf303779a886567c76e1528
7
- data.tar.gz: 9e38d46ac5722147f3f48ffecb1d5d08b3ae93ca4117c48792a3e8903561a84947e7c1d5e32d3d66ef1413519bf7c30e8bb8424b54d2af0b3d005c5cd93a6bca
6
+ metadata.gz: 4b0bd17834a7658027b98c43cf2b2514f4bdb3ee06974e21bd27932a81e4f4ce4a7785468623d92511026e8773ae9af78dccca88c3c1ba0ba88ee89ff06b81aa
7
+ data.tar.gz: 1544edbfac9e4d2f5723f220aadd5619b86ff3386dae982d6b53ee9d8e20ba264a52f54ee44a6194b9ae912d8f0684d2a20bd3f0ff33d8d0775ca09cae3b8d86
@@ -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
  }
@@ -36,15 +36,20 @@
36
36
  var moduleName = camelCaseAndCapitalise(moduleNames[j])
37
37
  var started = element.getAttribute('data-' + moduleNames[j] + '-module-started')
38
38
  if (typeof GOVUK.Modules[moduleName] === 'function' && !started) {
39
- // Vanilla JavaScript GOV.UK Modules and GOV.UK Frontend Modules
40
- if (GOVUK.Modules[moduleName].prototype.init) {
41
- try {
39
+ try {
40
+ if (GOVUK.Modules[moduleName].prototype.init) {
41
+ // Vanilla JavaScript GOV.UK Modules and GOV.UK Frontend V4 Modules
42
42
  new GOVUK.Modules[moduleName](element).init()
43
- element.setAttribute('data-' + moduleNames[j] + '-module-started', true)
44
- } catch (e) {
45
- // if there's a problem with the module, catch the error to allow other modules to start
46
- console.error('Error starting ' + moduleName + ' component JS: ', e, window.location)
43
+ } else {
44
+ // GOV.UK Frontend V5 Modules - removed component init() methods and initialise in constructor
45
+ // https://github.com/alphagov/govuk-design-system-architecture/blob/main/decision-records/010-remove-init-method.md
46
+ /* eslint-disable no-new */
47
+ new GOVUK.Modules[moduleName](element)
47
48
  }
49
+ element.setAttribute('data-' + moduleNames[j] + '-module-started', true)
50
+ } catch (e) {
51
+ // if there's a problem with the module, catch the error to allow other modules to start
52
+ console.error('Error starting ' + moduleName + ' component JS: ', e, window.location)
48
53
  }
49
54
  }
50
55
  }
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "38.3.1".freeze
2
+ VERSION = "38.4.0".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