govuk_publishing_components 21.26.0 → 21.26.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +18 -1
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +11 -1
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +14 -0
- data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5af29219bd4b9bc7b8ae363465464bc9be5b18379be56fb5749e1cc7770b5e
|
4
|
+
data.tar.gz: ad31407f577d64d7e5bf86692444d4ed50f548dfb077a20bc07c67ab2b8b915c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 650dd808ba0219ef1e49ba8c466efa63e3875d2fdc6022117ab758c7eaeb5e79ed39f71eb39a14ac7235272ade539a577d4ef6e639325c237db799fbd136aacf
|
7
|
+
data.tar.gz: 7192ab37e652830ccd24beac87b31249c0490bc98b81f3d16bdfaa8f070284a71d4c01dc14b23cc5fa47cc73ccb0a2b83abf951307710d9e84db40d74fb6fa93
|
@@ -44,7 +44,18 @@ module GovukPublishingComponents
|
|
44
44
|
additional_files = "@import 'govuk_publishing_components/govuk_frontend_support';\n"
|
45
45
|
additional_files << "@import 'govuk_publishing_components/component_support';\n" unless print_styles
|
46
46
|
|
47
|
-
|
47
|
+
components = components_in_use
|
48
|
+
extra_components = []
|
49
|
+
|
50
|
+
components.each do |component|
|
51
|
+
components_in_component = components_within_component(component)
|
52
|
+
extra_components << components_in_component
|
53
|
+
end
|
54
|
+
|
55
|
+
components << extra_components.compact
|
56
|
+
components = components.flatten.uniq.sort
|
57
|
+
|
58
|
+
components.map { |component|
|
48
59
|
"@import 'govuk_publishing_components/components/#{print_path}_#{component.gsub('_', '-')}';" if component_has_sass_file(component.gsub('_', '-'), print_styles)
|
49
60
|
}.join("\n").squeeze("\n").prepend(additional_files)
|
50
61
|
end
|
@@ -80,6 +91,12 @@ module GovukPublishingComponents
|
|
80
91
|
Pathname.new(__dir__ + "/../../assets/stylesheets/govuk_publishing_components/components/#{print_path}_#{component}.scss").exist?
|
81
92
|
end
|
82
93
|
|
94
|
+
def components_within_component(component)
|
95
|
+
data = File.read(Pathname.new(__dir__ + "/../../views/govuk_publishing_components/components/_#{component}.html.erb"))
|
96
|
+
match = data.scan(/(govuk_publishing_components\/components\/[a-z_-]+)/)
|
97
|
+
match.flatten.uniq.map(&:to_s).sort.map { |m| m.gsub('govuk_publishing_components/components/', '') }
|
98
|
+
end
|
99
|
+
|
83
100
|
def index_breadcrumb
|
84
101
|
{
|
85
102
|
title: GovukPublishingComponents::Config.component_guide_title,
|
@@ -24,14 +24,14 @@
|
|
24
24
|
} do %>
|
25
25
|
<%= render "govuk_publishing_components/components/textarea", {
|
26
26
|
label: {
|
27
|
-
text: "Add this to your application's main scss file"
|
27
|
+
text: "Add this to your application's main scss file, before your other local imports."
|
28
28
|
},
|
29
29
|
name: "main-sass",
|
30
30
|
value: @components_in_use_sass
|
31
31
|
} %>
|
32
32
|
<%= render "govuk_publishing_components/components/textarea", {
|
33
33
|
label: {
|
34
|
-
text: "Add this to your application's print scss file"
|
34
|
+
text: "Add this to your application's print scss file, before your other local imports."
|
35
35
|
},
|
36
36
|
name: "print-sass",
|
37
37
|
value: @components_in_use_print_sass
|
@@ -24,6 +24,16 @@
|
|
24
24
|
|
25
25
|
<ul class="gem-c-share-links__list">
|
26
26
|
<% links.each do |link| %>
|
27
|
+
<% link_text = capture do %>
|
28
|
+
<span class="govuk-visually-hidden">
|
29
|
+
<% if link[:hidden_text] %>
|
30
|
+
<%= link[:hidden_text] %>
|
31
|
+
<% else %>
|
32
|
+
Share on
|
33
|
+
<% end %>
|
34
|
+
</span>
|
35
|
+
<%= link[:text] %>
|
36
|
+
<% end %>
|
27
37
|
<li class="gem-c-share-links__list-item">
|
28
38
|
<%
|
29
39
|
if track_as_sharing
|
@@ -78,7 +88,7 @@
|
|
78
88
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="9 9 32 32"><path fill="currentColor" d="M9 9h32v32H9V9z"/><path fill="#FFF" d="M12.84 14.12v19.2h5.76l5.76 5.76v-5.76h12.8v-19.2H12.84zm3.2 8.32H28.2V25H16.04v-2.56zm16 7.68h-16v-2.56h16v2.56zm1.92-10.24H16.04v-2.56h17.92v2.56z"/></svg>
|
79
89
|
|
80
90
|
<% end %>
|
81
|
-
</span><%=
|
91
|
+
</span><%= link_text %><% end %>
|
82
92
|
</li>
|
83
93
|
<% end %>
|
84
94
|
</ul>
|
@@ -65,6 +65,20 @@ examples:
|
|
65
65
|
icon: 'facebook'
|
66
66
|
}
|
67
67
|
]
|
68
|
+
with_custom_visually_hidden_text:
|
69
|
+
description: |
|
70
|
+
Use this option to specify a visually hidden text for screenreaders to prepend to the link text.
|
71
|
+
|
72
|
+
If omitted, the default text used will be 'Share on'.
|
73
|
+
data:
|
74
|
+
links: [
|
75
|
+
{
|
76
|
+
href: 'share',
|
77
|
+
text: 'Facebook',
|
78
|
+
hidden_text: 'Download from',
|
79
|
+
icon: 'facebook'
|
80
|
+
}
|
81
|
+
]
|
68
82
|
with_branding:
|
69
83
|
description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_branding.md) can be added to the component as shown.
|
70
84
|
data:
|
@@ -16,8 +16,8 @@
|
|
16
16
|
<%= csrf_meta_tags %>
|
17
17
|
<%= favicon_link_tag "govuk_publishing_components/favicon-production.png" %>
|
18
18
|
|
19
|
-
<%= stylesheet_link_tag "component_guide/application", media: "screen" %>
|
20
19
|
<%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_stylesheet}" %>
|
20
|
+
<%= stylesheet_link_tag "component_guide/application", media: "screen" %>
|
21
21
|
|
22
22
|
<% if GovukPublishingComponents::Config.application_print_stylesheet %>
|
23
23
|
<%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_print_stylesheet}", media: "print" %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 21.26.
|
4
|
+
version: 21.26.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|