govuk_publishing_components 36.0.0 → 36.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 773208000d7b04127bf634415ed17bbfd977ba73ab9a45e2eca5742f19eacbc6
4
- data.tar.gz: c2b77952558ca4fd34c22e87088721dffe9d55346cc1cd9a5ac8ee3f64ff2087
3
+ metadata.gz: 9964e934f4ce2788b32ae7209b5838a04a44cadbb302c4cf45bd723fd6e9cf38
4
+ data.tar.gz: 9aa95ca3c117ebef6c201f29990e1b12961b53c435c7904936c44e7b22b53cd7
5
5
  SHA512:
6
- metadata.gz: 5d2efbb677bc763e54375000098c7419ccec70d70d4ad49093e6fda016788ec22ef989d8c7a480e5e9fa00d4dba4c6ac10672bb683baa67d129a3a49da80e460
7
- data.tar.gz: 5e34040e64f3863838db6c24a5d8e2c0f0d423d62f24f6841adb204e0071899699796c07740130b6ec06205a87cffdcfed80814a177f7eb6aa93cd7112e55e1a
6
+ metadata.gz: 1094205965013e02ab4655bd58fa2e6ac6cfad898ba94275ab93fc3bec5c738fff2fe575e34ac2429e66c912fc54c25afdcf3f878d6090e20ce180bc805e4aa5
7
+ data.tar.gz: 52f249d3d4edbf8f16d696154c5faf1e751ea386eae9ede15bde6ad248bd705eda6c91b98dfaf4f221c03908b5dd57e9b8ce84eba0c9e85d2078aee907dfe9a8
@@ -7,15 +7,10 @@
7
7
  checkboxes_count_id = checkboxes_id + "-count"
8
8
  show_filter ||= false
9
9
  large ||= false
10
-
11
- classes = %w[gem-c-option-select__container js-options-container]
12
- classes << "gem-c-option-select__container--large" if large
13
10
  %>
14
11
 
15
12
  <% if show_filter %>
16
- <%
17
- filter_id ||= "input-#{SecureRandom.hex(4)}"
18
- %>
13
+ <% filter_id ||= "input-#{SecureRandom.hex(4)}" %>
19
14
  <% filter = capture do %>
20
15
  <%= tag.label for: filter_id, class: "govuk-label govuk-visually-hidden" do %>
21
16
  Filter <%= title %>
@@ -34,20 +29,27 @@
34
29
  <% filter_element = CGI::escapeHTML(filter) %>
35
30
  <% end %>
36
31
 
37
- <div
38
- class="gem-c-option-select" data-module="option-select"
39
- <% if local_assigns.include?(:closed_on_load) && closed_on_load %>data-closed-on-load="true"<% end %>
40
- <% if local_assigns.include?(:closed_on_load_mobile) && closed_on_load_mobile %>data-closed-on-load-mobile="true"<% end %>
41
- <% if local_assigns.include?(:aria_controls_id) %>data-input-aria-controls="<%= aria_controls_id %>"<% end %>
42
- <% if show_filter %>data-filter-element="<%= filter_element %>"<% end %>
43
- >
32
+ <%
33
+ helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
34
+ helper.add_class("gem-c-option-select")
35
+ helper.add_data_attribute({ module: "option-select" })
36
+ helper.add_data_attribute({ "closed-on-load": true }) if local_assigns.include?(:closed_on_load) && closed_on_load
37
+ helper.add_data_attribute({ "closed-on-load-mobile": "true" }) if local_assigns.include?(:closed_on_load_mobile) && closed_on_load_mobile
38
+ helper.add_data_attribute({ "input-aria-controls": aria_controls_id }) if local_assigns.include?(:aria_controls_id)
39
+ helper.add_data_attribute({ "filter-element": filter_element }) if show_filter
40
+
41
+ options_container_classes = %w[gem-c-option-select__container js-options-container]
42
+ options_container_classes << "gem-c-option-select__container--large" if large
43
+ %>
44
+
45
+ <%= tag.div(**helper.all_attributes) do %>
44
46
  <h3 class="gem-c-option-select__heading js-container-heading">
45
47
  <span class="gem-c-option-select__title js-container-button" id="<%= title_id %>"><%= title %></span>
46
48
  <svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="0" height="0" class="gem-c-option-select__icon gem-c-option-select__icon--up" aria-hidden="true" focusable="false"><path d="m798.16 609.84l-256-256c-16.683-16.683-43.691-16.683-60.331 0l-256 256c-16.683 16.683-16.683 43.691 0 60.331s43.691 16.683 60.331 0l225.84-225.84 225.84 225.84c16.683 16.683 43.691 16.683 60.331 0s16.683-43.691 0-60.331z"/></svg>
47
49
  <svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="0" height="0" class="gem-c-option-select__icon gem-c-option-select__icon--down" aria-hidden="true" focusable="false"><path d="m225.84 414.16l256 256c16.683 16.683 43.691 16.683 60.331 0l256-256c16.683-16.683 16.683-43.691 0-60.331s-43.691-16.683-60.331 0l-225.84 225.84-225.84-225.84c-16.683-16.683-43.691-16.683-60.331 0s-16.683 43.691 0 60.331z"/></svg>
48
50
  </h3>
49
51
 
50
- <%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class: classes, id: options_container_id, tabindex: "-1") do %>
52
+ <%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class: options_container_classes, id: options_container_id, tabindex: "-1") do %>
51
53
  <div class="gem-c-option-select__container-inner js-auto-height-inner">
52
54
  <% if show_filter %>
53
55
  <span id="<%= checkboxes_count_id %>"
@@ -68,4 +70,4 @@
68
70
  } %>
69
71
  </div>
70
72
  <% end %>
71
- </div>
73
+ <% end %>
@@ -22,6 +22,7 @@ accessibility_criteria: |
22
22
  - inform the user that is it an editable field
23
23
  - inform the user when there are matches, or if there are no matches
24
24
  - inform the user as the number of matches changes
25
+ uses_component_wrapper_helper: true
25
26
  examples:
26
27
  default:
27
28
  data:
@@ -92,13 +92,12 @@ module GovukPublishingComponents
92
92
  def add_ga4_political_tags(meta_tags)
93
93
  government = content_item.dig(:links, :government, 0)
94
94
 
95
- # political: true/false is in a different place to current: true/false, which is why we have 'details' and 'government[:details]'
95
+ # political: true/false is in a different place to current: true/false, which is why we have 'details' and 'government.dig(:details)'
96
96
  if government && details[:political]
97
- meta_tags["govuk:ga4-political-status"] = government[:details][:current] ? "political" : "historic"
98
-
99
- government_title = government[:title]
100
- if government_title && !government[:details][:current]
101
- meta_tags["govuk:ga4-publishing-government"] = government_title
97
+ current_government = government.dig(:details, :current)
98
+ unless current_government
99
+ meta_tags["govuk:ga4-political-status"] = "historic"
100
+ meta_tags["govuk:ga4-publishing-government"] = government[:title] if government[:title]
102
101
  end
103
102
  end
104
103
 
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "36.0.0".freeze
2
+ VERSION = "36.0.2".freeze
3
3
  end
@@ -54,12 +54,12 @@ Demo: http://sortablejs.github.io/Sortable/
54
54
 
55
55
  Install with NPM:
56
56
  ```bash
57
- $ npm install sortablejs --save
57
+ npm install sortablejs --save
58
58
  ```
59
59
 
60
60
  Install with Bower:
61
61
  ```bash
62
- $ bower install --save sortablejs
62
+ bower install --save sortablejs
63
63
  ```
64
64
 
65
65
  Import into your project: