govuk_publishing_components 21.16.0 → 21.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +3 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -0
- data/app/views/govuk_publishing_components/components/_document_list.html.erb +57 -55
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +9 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3deb53c838696e8cdd502b0774af651a5c674079ef5e3f5a69f0f82020162852
|
4
|
+
data.tar.gz: cdcbd9c547dc673cab6561136515dd1577402a3df5ddb30055f3e943518bb885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe892a3eb3e0d32fa3402e3ab500f9cce34a4eca8c8520ddd6d59e8f2c124a0bb956b55305c58bc5239b1dcb299c6f6bc75b9a053799d0e07a349173ad5c5da3
|
7
|
+
data.tar.gz: 4bf254ca7d937f23ea26d0bd2a08975144c091665551a44e32f424a49a28326d1a6c3c9b13481275a99d7e1d46f66b7315ca0668aa10d67246f801e5e1ca27f2
|
@@ -68,6 +68,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
68
68
|
this.$module.showConfirmationMessage()
|
69
69
|
this.$module.cookieBannerConfirmationMessage.focus()
|
70
70
|
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
71
|
+
if (window.GOVUK.analyticsInit) {
|
72
|
+
window.GOVUK.analyticsInit()
|
73
|
+
}
|
71
74
|
}
|
72
75
|
|
73
76
|
CookieBanner.prototype.showConfirmationMessage = function () {
|
@@ -8,71 +8,73 @@
|
|
8
8
|
|
9
9
|
within_multitype_list ||= false
|
10
10
|
within_multitype_list_class = " gem-c-document-list__multi-list" if within_multitype_list
|
11
|
-
title_with_context_class = " gem-c-document-list__item-title--context"
|
12
11
|
|
13
12
|
brand ||= false
|
14
13
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
15
14
|
%>
|
15
|
+
<% def document(item, brand_helper) %>
|
16
|
+
<% title_with_context_class = " gem-c-document-list__item-title--context" %>
|
17
|
+
<% if item[:highlight] && item[:highlight_text] %>
|
18
|
+
<p class='gem-c-document-list__highlight-text'><%= item[:highlight_text] %></p>
|
19
|
+
<% end %>
|
20
|
+
<%=
|
21
|
+
item_classes = "gem-c-document-list__item-title #{brand_helper.color_class} #{title_with_context_class if item[:link][:context]}"
|
22
|
+
|
23
|
+
if item[:link][:path]
|
24
|
+
link_to(
|
25
|
+
item[:link][:text],
|
26
|
+
item[:link][:path],
|
27
|
+
data: item[:link][:data_attributes],
|
28
|
+
class: "#{item_classes} gem-c-document-list__item-link",
|
29
|
+
)
|
30
|
+
else
|
31
|
+
content_tag(
|
32
|
+
"span",
|
33
|
+
item[:link][:text],
|
34
|
+
data: item[:link][:data_attributes],
|
35
|
+
class: item_classes,
|
36
|
+
)
|
37
|
+
end
|
38
|
+
%>
|
39
|
+
<% if item[:link][:context] %>
|
40
|
+
<span class="gem-c-document-list__item-context"><%= item[:link][:context] %></span>
|
41
|
+
<% end %>
|
42
|
+
<% if item[:link][:description] %>
|
43
|
+
<p class="gem-c-document-list__item-description" ><%= item[:link][:description] %></p>
|
44
|
+
<% end %>
|
45
|
+
<% if item[:metadata] %>
|
46
|
+
<ul class="gem-c-document-list__item-metadata">
|
47
|
+
<% item[:metadata].compact.each do |item_metadata_key, item_metadata_value| %>
|
48
|
+
<li class="gem-c-document-list__attribute">
|
49
|
+
<% if item_metadata_key.to_s.eql?("public_updated_at") %>
|
50
|
+
<time datetime="<%= item_metadata_value.iso8601 %>">
|
51
|
+
<%= l(item_metadata_value, format: '%e %B %Y') %>
|
52
|
+
</time>
|
53
|
+
<% else %>
|
54
|
+
<%= item_metadata_value %>
|
55
|
+
<% end %>
|
56
|
+
</li>
|
57
|
+
<% end %>
|
58
|
+
</ul>
|
59
|
+
<% end %>
|
60
|
+
<% if item[:subtext] %>
|
61
|
+
<p class="gem-c-document-list__subtext"><%= item[:subtext] %></p>
|
62
|
+
<% end %>
|
63
|
+
<% end %>
|
16
64
|
<% if items.any? %>
|
17
|
-
<% unless within_multitype_list %>
|
65
|
+
<% unless within_multitype_list || items.one? %>
|
18
66
|
<ol class="<%= classes %>">
|
19
67
|
<% end %>
|
20
68
|
<% items.each do |item| %>
|
21
69
|
<% highlight_class = " gem-c-document-list__item--highlight" if item[:highlight] %>
|
22
70
|
|
23
|
-
|
24
|
-
<%
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if item[:link][:path]
|
32
|
-
link_to(
|
33
|
-
item[:link][:text],
|
34
|
-
item[:link][:path],
|
35
|
-
data: item[:link][:data_attributes],
|
36
|
-
class: "#{item_classes} gem-c-document-list__item-link",
|
37
|
-
)
|
38
|
-
else
|
39
|
-
content_tag(
|
40
|
-
"span",
|
41
|
-
item[:link][:text],
|
42
|
-
data: item[:link][:data_attributes],
|
43
|
-
class: item_classes,
|
44
|
-
)
|
45
|
-
end
|
46
|
-
%>
|
47
|
-
|
48
|
-
<% if item[:link][:context] %>
|
49
|
-
<span class="gem-c-document-list__item-context"><%= item[:link][:context] %></span>
|
50
|
-
<% end %>
|
51
|
-
|
52
|
-
<% if item[:link][:description] %>
|
53
|
-
<p class="gem-c-document-list__item-description" ><%= item[:link][:description] %></p>
|
54
|
-
<% end %>
|
55
|
-
|
56
|
-
<% if item[:metadata] %>
|
57
|
-
<ul class="gem-c-document-list__item-metadata">
|
58
|
-
<% item[:metadata].compact.each do |item_metadata_key, item_metadata_value| %>
|
59
|
-
<li class="gem-c-document-list__attribute">
|
60
|
-
<% if item_metadata_key.to_s.eql?("public_updated_at") %>
|
61
|
-
<time datetime="<%= item_metadata_value.iso8601 %>">
|
62
|
-
<%= l(item_metadata_value, format: '%e %B %Y') %>
|
63
|
-
</time>
|
64
|
-
<% else %>
|
65
|
-
<%= item_metadata_value %>
|
66
|
-
<% end %>
|
67
|
-
</li>
|
68
|
-
<% end %>
|
69
|
-
</ul>
|
70
|
-
<% end %>
|
71
|
-
|
72
|
-
<% if item[:subtext] %>
|
73
|
-
<p class="gem-c-document-list__subtext"><%= item[:subtext] %></p>
|
74
|
-
<% end %>
|
75
|
-
</li>
|
71
|
+
<% if items.one? %>
|
72
|
+
<% document(item, brand_helper) %>
|
73
|
+
<% else %>
|
74
|
+
<li class="gem-c-document-list__item<%= within_multitype_list_class %> <%= brand_helper.brand_class %> <%= highlight_class %>">
|
75
|
+
<% document(item, brand_helper) %>
|
76
|
+
</li>
|
77
|
+
<% end %>
|
76
78
|
<% end %>
|
77
79
|
<% unless within_multitype_list %>
|
78
80
|
</ol>
|
@@ -236,3 +236,12 @@ examples:
|
|
236
236
|
document_type: 'Organisation'
|
237
237
|
context:
|
238
238
|
right_to_left: true
|
239
|
+
with_a_single_item:
|
240
|
+
data:
|
241
|
+
items:
|
242
|
+
- link:
|
243
|
+
text: 'Alternative provision'
|
244
|
+
path: '/government/publications/alternative-provision'
|
245
|
+
metadata:
|
246
|
+
public_updated_at: 2016-06-27 10:29:44
|
247
|
+
document_type: 'Statutory guidance'
|