govuk_publishing_components 57.1.0 → 57.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/intervention/hmrc.svg +5 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +4 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +22 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +72 -12
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +2 -2
  7. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +10 -0
  8. data/app/assets/javascripts/govuk_publishing_components/components/add-another.js +57 -7
  9. data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +24 -4
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +17 -0
  11. data/app/controllers/govuk_publishing_components/audit_controller.rb +0 -1
  12. data/app/models/govuk_publishing_components/audit_comparer.rb +0 -1
  13. data/app/views/govuk_publishing_components/components/_add_another.html.erb +2 -0
  14. data/app/views/govuk_publishing_components/components/_intervention.html.erb +7 -2
  15. data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +24 -2
  16. data/app/views/govuk_publishing_components/components/_select.html.erb +6 -2
  17. data/app/views/govuk_publishing_components/components/docs/add_another.yml +25 -0
  18. data/app/views/govuk_publishing_components/components/docs/intervention.yml +10 -0
  19. data/app/views/govuk_publishing_components/components/docs/reorderable_list.yml +16 -0
  20. data/app/views/govuk_publishing_components/components/docs/select.yml +25 -0
  21. data/config/locales/ar.yml +12 -3
  22. data/config/locales/az.yml +12 -3
  23. data/config/locales/be.yml +12 -3
  24. data/config/locales/bg.yml +12 -3
  25. data/config/locales/bn.yml +12 -3
  26. data/config/locales/cs.yml +12 -3
  27. data/config/locales/cy.yml +14 -5
  28. data/config/locales/da.yml +12 -3
  29. data/config/locales/de.yml +12 -3
  30. data/config/locales/dr.yml +12 -3
  31. data/config/locales/el.yml +12 -3
  32. data/config/locales/en.yml +16 -7
  33. data/config/locales/es-419.yml +12 -3
  34. data/config/locales/es.yml +12 -3
  35. data/config/locales/et.yml +12 -3
  36. data/config/locales/fa.yml +12 -3
  37. data/config/locales/fi.yml +12 -3
  38. data/config/locales/fr.yml +12 -3
  39. data/config/locales/gd.yml +12 -3
  40. data/config/locales/gu.yml +12 -3
  41. data/config/locales/he.yml +12 -3
  42. data/config/locales/hi.yml +12 -3
  43. data/config/locales/hr.yml +12 -3
  44. data/config/locales/hu.yml +12 -3
  45. data/config/locales/hy.yml +12 -3
  46. data/config/locales/id.yml +12 -3
  47. data/config/locales/is.yml +12 -3
  48. data/config/locales/it.yml +12 -3
  49. data/config/locales/ja.yml +12 -3
  50. data/config/locales/ka.yml +12 -3
  51. data/config/locales/kk.yml +12 -3
  52. data/config/locales/ko.yml +12 -3
  53. data/config/locales/lt.yml +12 -3
  54. data/config/locales/lv.yml +12 -3
  55. data/config/locales/ms.yml +12 -3
  56. data/config/locales/mt.yml +12 -3
  57. data/config/locales/ne.yml +12 -6
  58. data/config/locales/nl.yml +12 -3
  59. data/config/locales/no.yml +12 -3
  60. data/config/locales/pa-pk.yml +12 -3
  61. data/config/locales/pa.yml +12 -3
  62. data/config/locales/pl.yml +12 -3
  63. data/config/locales/ps.yml +12 -3
  64. data/config/locales/pt.yml +12 -3
  65. data/config/locales/ro.yml +12 -3
  66. data/config/locales/ru.yml +12 -3
  67. data/config/locales/si.yml +12 -3
  68. data/config/locales/sk.yml +12 -3
  69. data/config/locales/sl.yml +12 -3
  70. data/config/locales/so.yml +12 -3
  71. data/config/locales/sq.yml +12 -3
  72. data/config/locales/sr.yml +12 -3
  73. data/config/locales/sv.yml +12 -3
  74. data/config/locales/sw.yml +12 -3
  75. data/config/locales/ta.yml +12 -3
  76. data/config/locales/th.yml +12 -3
  77. data/config/locales/tk.yml +12 -3
  78. data/config/locales/tr.yml +12 -3
  79. data/config/locales/uk.yml +12 -3
  80. data/config/locales/ur.yml +12 -3
  81. data/config/locales/uz.yml +12 -3
  82. data/config/locales/vi.yml +12 -3
  83. data/config/locales/zh-hk.yml +12 -3
  84. data/config/locales/zh-tw.yml +12 -3
  85. data/config/locales/zh.yml +12 -3
  86. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +14 -13
  87. data/lib/govuk_publishing_components/presenters/select_helper.rb +5 -3
  88. data/lib/govuk_publishing_components/version.rb +1 -1
  89. metadata +2 -1
@@ -58,18 +58,27 @@ zh:
58
58
  devolved_nations:
59
59
  applies_to:
60
60
  aria_label:
61
- connectors:
62
- last_word:
63
- two_words:
64
61
  england:
62
+ end:
63
+ middle:
64
+ start:
65
65
  northern_ireland:
66
+ end:
67
+ middle:
68
+ start:
66
69
  scotland:
70
+ end:
71
+ middle:
72
+ start:
67
73
  type:
68
74
  consultation:
69
75
  detailed_guide:
70
76
  guidance:
71
77
  publication:
72
78
  wales:
79
+ end:
80
+ middle:
81
+ start:
73
82
  feedback:
74
83
  close: 关闭
75
84
  dont_include_personal_info: 不要包含个人或财务信息,比如您的国家保险号或信用卡信息。
@@ -9,20 +9,21 @@ module GovukPublishingComponents
9
9
  end
10
10
 
11
11
  def applicable_nations_title_text(use_english_translation = nil)
12
- @national_applicability
13
- .select { |_, v| v[:applicable] == true }
14
- .map { |k, _| get_translation("components.devolved_nations.#{k}", use_english_translation) }
15
- .sort
16
- .to_sentence(
17
- two_words_connector: get_translation("components.devolved_nations.connectors.two_words", use_english_translation),
18
- last_word_connector: get_translation("components.devolved_nations.connectors.last_word", use_english_translation),
19
- )
12
+ nation_keys = @national_applicability
13
+ .select { |_, v| v[:applicable] == true }
14
+ .map { |k, _| k }
15
+ nation_keys.each_with_index.map { |k, i| name_for_position(k, i, nation_keys.count, use_english_translation) }.join
20
16
  end
21
17
 
22
- def get_translation(key, use_english_translation = nil)
23
- return I18n.t(key, locale: :en) if use_english_translation
24
-
25
- I18n.t(key)
18
+ def name_for_position(nation, position, total, use_english_translation)
19
+ key = if position.zero?
20
+ :start
21
+ elsif position == (total - 1)
22
+ :end
23
+ else
24
+ :middle
25
+ end
26
+ I18n.t("components.devolved_nations.#{nation}.#{key}", locale: use_english_translation ? :en : nil)
26
27
  end
27
28
 
28
29
  def ga4_applicable_nations_title_text(remove_connector_word = nil)
@@ -40,7 +41,7 @@ module GovukPublishingComponents
40
41
  end
41
42
 
42
43
  def alternative_content_text(name)
43
- nation = I18n.t("components.devolved_nations.#{name}")
44
+ nation = I18n.t("components.devolved_nations.#{name}.start")
44
45
 
45
46
  if I18n.exists?("components.devolved_nations.type.#{@content_type}")
46
47
  I18n.t("components.devolved_nations.type.#{@content_type}", nation:)
@@ -44,13 +44,15 @@ module GovukPublishingComponents
44
44
  [
45
45
  option[:text],
46
46
  option[:value],
47
- options_data_attribute(option[:data_attributes]),
47
+ options_extra_attributes(option[:data_attributes], option[:disabled]),
48
48
  ]
49
49
  end
50
50
  end
51
51
 
52
- def options_data_attribute(attributes)
53
- return {} if attributes.nil?
52
+ def options_extra_attributes(attributes, disabled)
53
+ attrs = {}
54
+ attrs[:disabled] = true if disabled
55
+ return attrs if attributes.nil?
54
56
 
55
57
  attrs = {}
56
58
  attributes.each do |key, value|
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "57.1.0".freeze
2
+ VERSION = "57.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 57.1.0
4
+ version: 57.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -437,6 +437,7 @@ files:
437
437
  - app/assets/images/govuk_publishing_components/image-card-srcset/cop26-320.jpg
438
438
  - app/assets/images/govuk_publishing_components/image-card-srcset/cop26-480.jpg
439
439
  - app/assets/images/govuk_publishing_components/image-card-srcset/cop26.jpg
440
+ - app/assets/images/govuk_publishing_components/intervention/hmrc.svg
440
441
  - app/assets/images/govuk_publishing_components/take-action-amber.svg
441
442
  - app/assets/images/govuk_publishing_components/take-action-green.svg
442
443
  - app/assets/images/govuk_publishing_components/take-action-red.svg