govuk_publishing_components 7.3.0 → 8.0.0
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/lib/track-share-button-clicks.js +26 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +3 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +43 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +49 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +40 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/{_organisation-colours.scss → _brand-colours.scss} +3 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_back-arrow.scss +13 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_touch-friendly-links.scss +11 -0
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +49 -0
- data/app/views/govuk_publishing_components/components/_button.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +4 -4
- data/app/views/govuk_publishing_components/components/_heading.html.erb +7 -9
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +36 -0
- data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +24 -26
- data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_translation-nav.html.erb +19 -5
- data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +94 -0
- data/app/views/govuk_publishing_components/components/docs/heading.yml +46 -7
- data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +0 -10
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +38 -0
- data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +29 -0
- data/app/views/govuk_publishing_components/components/docs/translation-nav.yml +38 -0
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
- data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -1
- data/lib/govuk_publishing_components.rb +4 -0
- data/lib/govuk_publishing_components/presenters/breadcrumbs.rb +39 -0
- data/lib/govuk_publishing_components/presenters/heading_helper.rb +20 -0
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +0 -15
- data/lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb +6 -1
- data/lib/govuk_publishing_components/presenters/subscription_links_helper.rb +45 -0
- data/lib/govuk_publishing_components/presenters/translation_nav_helper.rb +23 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd52f88bf159c19cfb93fc4b1df1ac5f20640df6bf81701ca6f82d807a961d28
|
4
|
+
data.tar.gz: 9344c8672e431f493d26a544574b9c35a0e76bd1d0a10b1635251101bd24b98b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fba10ac52900e63df031d84ecc8d483907ed08562a063ff890a8be435daac246a99b8baf9222c738533ead8ddd947ecda024dc4a5a33fe8c7b52d451bc66198
|
7
|
+
data.tar.gz: 193ebcacae31c40abedf4de85212b0648ea679d5eee0caf0523a2fb9117a0751851835a046c63eb24c7a0a60b3666c40f1afa52768fe899f0f7113169d941344
|
@@ -0,0 +1,26 @@
|
|
1
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
2
|
+
|
3
|
+
(function (Modules) {
|
4
|
+
'use strict'
|
5
|
+
|
6
|
+
Modules.GemTrackShareButtonClicks = function () {
|
7
|
+
this.start = function (element) {
|
8
|
+
element.on('click', '.js-share-facebook', trackFacebook)
|
9
|
+
element.on('click', '.js-share-twitter', trackTwitter)
|
10
|
+
|
11
|
+
function trackFacebook () {
|
12
|
+
trackShare('facebook')
|
13
|
+
}
|
14
|
+
|
15
|
+
function trackTwitter () {
|
16
|
+
trackShare('twitter')
|
17
|
+
}
|
18
|
+
|
19
|
+
function trackShare (network) {
|
20
|
+
if (GOVUK.analytics && GOVUK.analytics.trackShare) {
|
21
|
+
GOVUK.analytics.trackShare(network)
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
})(window.GOVUK.Modules)
|
@@ -7,9 +7,10 @@
|
|
7
7
|
@import "typography";
|
8
8
|
@import "colours";
|
9
9
|
|
10
|
-
@import "components/helpers/
|
10
|
+
@import "components/helpers/brand-colours";
|
11
11
|
|
12
12
|
@import "components/back-link";
|
13
|
+
@import "components/breadcrumbs";
|
13
14
|
@import "components/button";
|
14
15
|
@import "components/document-list";
|
15
16
|
@import "components/error-summary";
|
@@ -28,4 +29,5 @@
|
|
28
29
|
@import "components/feedback";
|
29
30
|
@import "components/inverse-header";
|
30
31
|
@import "components/success-alert";
|
32
|
+
@import "components/share-links";
|
31
33
|
@import "components/taxonomy-navigation";
|
@@ -0,0 +1,43 @@
|
|
1
|
+
@import "design-patterns/breadcrumbs";
|
2
|
+
@import "mixins/back-arrow";
|
3
|
+
@import "mixins/media-down";
|
4
|
+
@import "mixins/touch-friendly-links";
|
5
|
+
|
6
|
+
.gem-c-breadcrumbs {
|
7
|
+
// reset the default browser styles
|
8
|
+
ol {
|
9
|
+
padding: 0;
|
10
|
+
margin: 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
@include breadcrumbs;
|
14
|
+
@include touch-friendly-links();
|
15
|
+
|
16
|
+
.gem-c-breadcrumbs--current {
|
17
|
+
color: $secondary-text-colour;
|
18
|
+
text-decoration: none;
|
19
|
+
}
|
20
|
+
|
21
|
+
@include media-down(mobile) {
|
22
|
+
&.gem-c-breadcrumbs--collapse-on-mobile .gem-c-breadcrumbs--item {
|
23
|
+
display: none;
|
24
|
+
|
25
|
+
&.gem-c-breadcrumbs--parent {
|
26
|
+
background-image: none;
|
27
|
+
display: block;
|
28
|
+
margin-left: 0;
|
29
|
+
padding-left: 14px;
|
30
|
+
position: relative;
|
31
|
+
|
32
|
+
&:before {
|
33
|
+
@include back-arrow;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
.gem-c-breadcrumbs--current.gem-c-breadcrumbs--inverse,
|
41
|
+
.gem-c-breadcrumbs .gem-c-breadcrumbs--inverse {
|
42
|
+
color: $white;
|
43
|
+
}
|
@@ -1,5 +1,18 @@
|
|
1
1
|
.gem-c-heading {
|
2
2
|
@include bold-27;
|
3
|
+
}
|
4
|
+
|
5
|
+
.gem-c-heading--font-size-24 {
|
6
|
+
@include bold-24;
|
7
|
+
}
|
8
|
+
|
9
|
+
.gem-c-heading--font-size-19 {
|
10
|
+
@include bold-19;
|
11
|
+
}
|
12
|
+
|
13
|
+
// special case for publications and consultations pages
|
14
|
+
// separated to allow normalisation of the component for wider use
|
15
|
+
.gem-c-heading--mobile-top-margin {
|
3
16
|
margin-top: $gutter;
|
4
17
|
margin-bottom: $gutter-half;
|
5
18
|
|
@@ -8,3 +21,39 @@
|
|
8
21
|
margin-bottom: $gutter;
|
9
22
|
}
|
10
23
|
}
|
24
|
+
|
25
|
+
.gem-c-heading--padding {
|
26
|
+
padding: $gutter-half 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
// margins would ideally be handled by a general model for all components
|
30
|
+
// but we don't have one yet, so this is in anticipation of that
|
31
|
+
// suggested scale is as follows, not fully implemented
|
32
|
+
// $gutter = 4
|
33
|
+
// $gutter-two-thirds = 3
|
34
|
+
// $gutter-half = 2
|
35
|
+
// $gutter-one-third = 1
|
36
|
+
.gem-c-heading--margin-bottom-4 {
|
37
|
+
margin-bottom: $gutter;
|
38
|
+
}
|
39
|
+
|
40
|
+
.gem-c-heading--margin-bottom-2 {
|
41
|
+
margin-bottom: $gutter-half;
|
42
|
+
}
|
43
|
+
|
44
|
+
// border color will default to black
|
45
|
+
// can be changed using the branding functionality
|
46
|
+
.gem-c-heading--border-top-1 {
|
47
|
+
border-top-style: solid;
|
48
|
+
border-top-width: 1px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.gem-c-heading--border-top-2 {
|
52
|
+
border-top-style: solid;
|
53
|
+
border-top-width: 2px;
|
54
|
+
}
|
55
|
+
|
56
|
+
.gem-c-heading--border-top-5 {
|
57
|
+
border-top-style: solid;
|
58
|
+
border-top-width: 5px;
|
59
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$share-button-width: 32px;
|
2
|
+
$share-button-height: 32px;
|
3
|
+
|
4
|
+
.gem-c-share-links__link {
|
5
|
+
margin-right: $gutter;
|
6
|
+
margin-bottom: $gutter-one-third;
|
7
|
+
@include bold-16($line-height: $share-button-height, $line-height-640: $share-button-height);
|
8
|
+
text-decoration: none;
|
9
|
+
}
|
10
|
+
|
11
|
+
.gem-c-share-links__title {
|
12
|
+
margin-bottom: $gutter-one-third;
|
13
|
+
}
|
14
|
+
|
15
|
+
.gem-c-share-links__link__icon {
|
16
|
+
display: inline-block;
|
17
|
+
width: $share-button-width;
|
18
|
+
height: $share-button-height;
|
19
|
+
margin-right: $gutter-one-third;
|
20
|
+
vertical-align: top;
|
21
|
+
}
|
22
|
+
|
23
|
+
.direction-rtl {
|
24
|
+
.gem-c-share-links__link {
|
25
|
+
// By changing the link to inline-block the browser
|
26
|
+
// calculates the icon and the text as a single run of text
|
27
|
+
// rather than two. When they are considered to be two runs
|
28
|
+
// the browser splits the first link, putting the text before
|
29
|
+
// the second link, and the icon after the second link.
|
30
|
+
display: inline-block;
|
31
|
+
margin-right: 0;
|
32
|
+
margin-left: $gutter;
|
33
|
+
|
34
|
+
.gem-c-share-links__link__icon {
|
35
|
+
margin-right: 0;
|
36
|
+
margin-left: $gutter-one-third;
|
37
|
+
vertical-align: middle;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -10,6 +10,9 @@
|
|
10
10
|
color: nth($organisation, 3);
|
11
11
|
}
|
12
12
|
|
13
|
+
// the & declaration allows border-color to also be applied to the parent
|
14
|
+
// element as required by the heading component, adds 2KB to the CSS
|
15
|
+
&.brand__border-color,
|
13
16
|
.brand__border-color {
|
14
17
|
border-color: nth($organisation, 2);
|
15
18
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// An arrow to represent a "back" link
|
2
|
+
|
3
|
+
@mixin back-arrow {
|
4
|
+
border-bottom: 5px solid transparent;
|
5
|
+
border-right: 6px solid;
|
6
|
+
border-top: 5px solid transparent;
|
7
|
+
content: '';
|
8
|
+
display: block;
|
9
|
+
left: 0;
|
10
|
+
margin-top: -6px;
|
11
|
+
position: absolute;
|
12
|
+
top: 50%;
|
13
|
+
}
|
data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_touch-friendly-links.scss
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
// This mixin will expand the clickable area for a link to make it easier to click on a touch-enabled
|
2
|
+
// device.
|
3
|
+
|
4
|
+
@mixin touch-friendly-links($padding: 3px) {
|
5
|
+
a {
|
6
|
+
padding: $padding;
|
7
|
+
margin: -1 * $padding;
|
8
|
+
outline-color: transparent;
|
9
|
+
display: inline-block;
|
10
|
+
}
|
11
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%
|
2
|
+
breadcrumbs ||= []
|
3
|
+
collapse_on_mobile ||= false
|
4
|
+
inverse ||= false
|
5
|
+
collapse_class = collapse_on_mobile && breadcrumbs.any? { |crumb| crumb[:is_page_parent] } ? "gem-c-breadcrumbs--collapse-on-mobile" : ""
|
6
|
+
invert_class = inverse ? "gem-c-breadcrumbs--inverse" : ""
|
7
|
+
structured_data = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs, request.path).structured_data
|
8
|
+
%>
|
9
|
+
|
10
|
+
<script type="application/ld+json">
|
11
|
+
<%= raw structured_data.to_json %>
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<div class="gem-c-breadcrumbs <%= collapse_class %>" data-module="track-click">
|
15
|
+
<ol>
|
16
|
+
<% breadcrumbs.each_with_index do |crumb, index| %>
|
17
|
+
<%
|
18
|
+
is_link = crumb[:url].present? || crumb[:is_current_page]
|
19
|
+
path = crumb[:is_current_page] ? '#content' : crumb[:url]
|
20
|
+
aria_current = crumb[:is_current_page] ? 'page' : 'false'
|
21
|
+
css_class = invert_class.concat(crumb[:is_current_page] ? ' gem-c-breadcrumbs--current ' : '')
|
22
|
+
%>
|
23
|
+
|
24
|
+
<li class='gem-c-breadcrumbs--item <%= "gem-c-breadcrumbs--parent" if crumb[:is_page_parent] %>'>
|
25
|
+
<% if is_link %>
|
26
|
+
<%= link_to(
|
27
|
+
crumb[:title],
|
28
|
+
path,
|
29
|
+
data: {
|
30
|
+
track_category: 'breadcrumbClicked',
|
31
|
+
track_action: index + 1,
|
32
|
+
track_label: path,
|
33
|
+
track_options: {
|
34
|
+
dimension28: breadcrumbs.length.to_s,
|
35
|
+
dimension29: crumb[:title]
|
36
|
+
}
|
37
|
+
},
|
38
|
+
class: css_class,
|
39
|
+
aria: {
|
40
|
+
current: aria_current,
|
41
|
+
}
|
42
|
+
) %>
|
43
|
+
<% else %>
|
44
|
+
<%= crumb[:title] %>
|
45
|
+
<% end %>
|
46
|
+
</li>
|
47
|
+
<% end %>
|
48
|
+
</ol>
|
49
|
+
</div>
|
@@ -18,12 +18,12 @@
|
|
18
18
|
html_options[:title] = title if title
|
19
19
|
%>
|
20
20
|
<% if href %>
|
21
|
-
<%= link_to(text, href
|
21
|
+
<%= link_to(text, href, html_options) %>
|
22
22
|
<% else %>
|
23
23
|
<%= button_tag(text, html_options) %>
|
24
24
|
<% end %>
|
25
25
|
<% if info_text %>
|
26
26
|
<span class="gem-c-button__info-text">
|
27
|
-
<%= info_text
|
27
|
+
<%= info_text %>
|
28
28
|
</span>
|
29
29
|
<% end %>
|
@@ -6,18 +6,18 @@
|
|
6
6
|
navigation.step_nav_helper.header %>
|
7
7
|
<% elsif navigation.content_tagged_to_mainstream_browse_pages? %>
|
8
8
|
<!-- Rendering parent-based breadcrumbs because the page is tagged to mainstream browse -->
|
9
|
-
<%= render '
|
9
|
+
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
|
10
10
|
<% elsif navigation.content_has_curated_related_items? %>
|
11
11
|
<!-- Rendering parent-based breadcrumbs because the page has curated related links -->
|
12
|
-
<%= render '
|
12
|
+
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
|
13
13
|
<% elsif navigation.content_is_tagged_to_a_live_taxon? %>
|
14
14
|
<!-- Rendering taxonomy breadcrumbs because the page is tagged to live taxons -->
|
15
|
-
<%= render '
|
15
|
+
<%= render 'govuk_publishing_components/components/breadcrumbs',
|
16
16
|
breadcrumbs: navigation.taxon_breadcrumbs[:breadcrumbs],
|
17
17
|
collapse_on_mobile: true %>
|
18
18
|
<% elsif navigation.breadcrumbs.any? %>
|
19
19
|
<!-- Rendering parent-based breadcrumbs because no browse, no related links, no live taxons -->
|
20
|
-
<%= render '
|
20
|
+
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
|
21
21
|
<% else %>
|
22
22
|
<!-- Not rendering any breadcrumbs because there aren't any -->
|
23
23
|
<% end %>
|
@@ -1,11 +1,9 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
brand ||= false
|
3
|
+
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
4
|
+
heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
|
5
5
|
%>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<%= text %>
|
11
|
-
</<%= heading_level_tag %>>
|
6
|
+
<%= content_tag(heading_helper.heading_tag, text,
|
7
|
+
class: "gem-c-heading #{heading_helper.classes} #{brand_helper.brand_class} #{brand_helper.border_color_class}",
|
8
|
+
id: heading_helper.id
|
9
|
+
) %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%
|
2
|
+
title ||= 'Share this page'
|
3
|
+
facebook_href ||= false
|
4
|
+
twitter_href ||= false
|
5
|
+
%>
|
6
|
+
<% if facebook_href || twitter_href %>
|
7
|
+
<div class="gem-c-share-links dont-print" data-module="gem-track-share-button-clicks">
|
8
|
+
<h2 class="gem-c-share-links__title"><%= title %></h2>
|
9
|
+
|
10
|
+
<% if facebook_href %>
|
11
|
+
<%= link_to facebook_href,
|
12
|
+
target: "_blank",
|
13
|
+
rel: "noopener noreferrer",
|
14
|
+
class: "gem-c-share-links__link js-share-facebook" do %>
|
15
|
+
<span class="gem-c-share-links__link__icon">
|
16
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
17
|
+
<path fill="currentColor" d="M31.006 0H.993A.997.997 0 0 0 0 .993v30.014c0 .55.452.993.993.993h30.013a.998.998 0 0 0 .994-.993V.993A.999.999 0 0 0 31.006 0z"/>
|
18
|
+
<path fill="#FFF" d="M17.892 10.751h1.787V8.009L17.216 8c-2.73 0-3.352 2.045-3.352 3.353v1.828h-1.581v2.824h1.581V24h3.322v-7.995h2.242l.291-2.824h-2.533V11.52c.001-.623.415-.769.706-.769z"/>
|
19
|
+
</svg>
|
20
|
+
</span><span class="visually-hidden">Share on </span>Facebook<% end %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<% if twitter_href %>
|
24
|
+
<%= link_to twitter_href,
|
25
|
+
target: "_blank",
|
26
|
+
rel: "noopener noreferrer",
|
27
|
+
class: "gem-c-share-links__link js-share-twitter" do %>
|
28
|
+
<span class="gem-c-share-links__link__icon">
|
29
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
30
|
+
<path fill="currentColor" d="M31.007 0H.993A.999.999 0 0 0 0 .993v30.014c0 .55.452.993.993.993h30.014a.997.997 0 0 0 .993-.993V.993A.998.998 0 0 0 31.007 0z"/>
|
31
|
+
<path fill="#FFF" d="M8 21.027a9.286 9.286 0 0 0 5.032 1.475c6.038 0 9.34-5.002 9.34-9.339 0-.143-.004-.284-.012-.425a6.619 6.619 0 0 0 1.639-1.699c-.6.265-1.234.439-1.885.516a3.287 3.287 0 0 0 1.443-1.816 6.571 6.571 0 0 1-2.086.797 3.28 3.28 0 0 0-5.592 2.993 9.311 9.311 0 0 1-6.766-3.43 3.294 3.294 0 0 0-.443 1.651 3.28 3.28 0 0 0 1.46 2.732 3.278 3.278 0 0 1-1.488-.411v.041a3.288 3.288 0 0 0 2.633 3.22 3.28 3.28 0 0 1-1.481.055 3.285 3.285 0 0 0 3.065 2.281 6.59 6.59 0 0 1-4.076 1.404A6.76 6.76 0 0 1 8 21.027z"/>
|
32
|
+
</svg>
|
33
|
+
</span><span class="visually-hidden">Share on </span>Twitter<% end %>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
@@ -1,42 +1,40 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
feed_link_text ||= t("govuk_component.subscription_links.feed_link_text", default: "Subscribe to feed")
|
6
|
-
feed_link_box_value ||= false
|
7
|
-
feed_link_data = false
|
8
|
-
|
9
|
-
if feed_link_box_value
|
10
|
-
feed_link = "#"
|
11
|
-
feed_link_data = {
|
12
|
-
controls: "feed-reader",
|
13
|
-
expanded: "false"
|
14
|
-
}
|
15
|
-
end
|
2
|
+
brand ||= false
|
3
|
+
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
4
|
+
sl_helper = GovukPublishingComponents::Presenters::SubscriptionLinksHelper.new(local_assigns)
|
16
5
|
%>
|
17
|
-
<% if
|
18
|
-
<section
|
6
|
+
<% if sl_helper.component_data_is_valid? %>
|
7
|
+
<section
|
8
|
+
class="gem-c-subscription-links <%= brand_helper.brand_class %>"
|
9
|
+
<%= "data-module=gem-toggle" if sl_helper.feed_link_box_value %>
|
10
|
+
>
|
19
11
|
<h2 class="visuallyhidden"><%= t("govuk_component.subscription_links.subscriptions", default: "Subscriptions") %></h2>
|
20
|
-
<ul
|
21
|
-
|
12
|
+
<ul
|
13
|
+
class="gem-c-subscription-links__list"
|
14
|
+
<%= "data-module=track-click" if sl_helper.tracking_is_present? %>
|
15
|
+
>
|
16
|
+
<% if sl_helper.email_signup_link.present? %>
|
22
17
|
<li class="gem-c-subscription-links__list-item">
|
23
|
-
<%= link_to email_signup_link_text, email_signup_link,
|
18
|
+
<%= link_to sl_helper.email_signup_link_text, sl_helper.email_signup_link,
|
19
|
+
class: "gem-c-subscription-links__link gem-c-subscription-links__link--email-alerts #{brand_helper.color_class}",
|
20
|
+
data: sl_helper.email_signup_link_data_attributes
|
21
|
+
%>
|
24
22
|
</li>
|
25
23
|
<% end %>
|
26
24
|
|
27
|
-
<% if feed_link_box_value || feed_link
|
25
|
+
<% if sl_helper.feed_link_box_value || sl_helper.feed_link %>
|
28
26
|
<li class="gem-c-subscription-links__list-item">
|
29
|
-
<%= link_to feed_link_text, feed_link,
|
30
|
-
|
31
|
-
|
27
|
+
<%= link_to sl_helper.feed_link_text, sl_helper.feed_link,
|
28
|
+
class: "gem-c-subscription-links__link gem-c-subscription-links__link--feed #{brand_helper.color_class}",
|
29
|
+
data: sl_helper.feed_link_data_attributes
|
32
30
|
%>
|
33
31
|
</li>
|
34
32
|
<% end %>
|
35
33
|
</ul>
|
36
34
|
|
37
|
-
<% if feed_link_box_value %>
|
38
|
-
<div class="gem-c-subscription-links__feed-box js-hidden" id="
|
39
|
-
<p class="gem-c-subscription-links__feed-description js-hidden"><%= feed_link_text %></p>
|
35
|
+
<% if sl_helper.feed_link_box_value %>
|
36
|
+
<div class="gem-c-subscription-links__feed-box js-hidden" id="<%= sl_helper.feed_box_id %>">
|
37
|
+
<p class="gem-c-subscription-links__feed-description js-hidden"><%= sl_helper.feed_link_text %></p>
|
40
38
|
<%= render "govuk_publishing_components/components/input", {
|
41
39
|
label: {
|
42
40
|
text: "Copy and paste this URL into your feed reader"
|
@@ -1,13 +1,27 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
1
|
+
<%
|
2
|
+
brand ||= false
|
3
|
+
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
4
|
+
translation_helper = GovukPublishingComponents::Presenters::TranslationNavHelper.new(local_assigns)
|
5
|
+
%>
|
6
|
+
<% if translation_helper.has_translations? %>
|
7
|
+
<nav role="navigation"
|
8
|
+
class="gem-c-translation-nav <%= brand_helper.brand_class %>"
|
9
|
+
aria-label="<%= t("common.translations") %>"
|
10
|
+
<%= "data-module=\"track-click\"" if translation_helper.tracking_is_present? %>
|
11
|
+
>
|
4
12
|
<ul class="gem-c-translation-nav__list">
|
5
|
-
<% translations.each.with_index do |translation, i| %>
|
13
|
+
<% translation_helper.translations.each.with_index do |translation, i| %>
|
6
14
|
<li class="gem-c-translation-nav__list-item">
|
7
15
|
<% if translation[:active] %>
|
8
16
|
<span lang="<%= translation[:locale] %>"><%= translation[:text] %></span>
|
9
17
|
<% else %>
|
10
|
-
<%= link_to translation[:text], translation[:base_path],
|
18
|
+
<%= link_to translation[:text], translation[:base_path],
|
19
|
+
hreflang: translation[:locale],
|
20
|
+
lang: translation[:locale],
|
21
|
+
rel: "alternate",
|
22
|
+
class: brand_helper.color_class,
|
23
|
+
data: translation[:data_attributes]
|
24
|
+
%>
|
11
25
|
<% end %>
|
12
26
|
</li>
|
13
27
|
<% end %>
|
@@ -0,0 +1,94 @@
|
|
1
|
+
name: "Breadcrumbs"
|
2
|
+
description: "Navigational breadcrumbs, showing page hierarchy"
|
3
|
+
body: |
|
4
|
+
Accepts an array of breadcrumb objects. Each crumb must have a title and a URL.
|
5
|
+
shared_accessibility_criteria:
|
6
|
+
- link
|
7
|
+
accessibility_criteria:
|
8
|
+
The breadcrumb links must have a text contrast ratio higher than 4.5:1 against the background colour to meet WCAG AA
|
9
|
+
(this especially applies when [using the inverse flag](/component-guide/breadcrumbs/inverse)).
|
10
|
+
examples:
|
11
|
+
default:
|
12
|
+
data:
|
13
|
+
breadcrumbs:
|
14
|
+
- title: 'Section'
|
15
|
+
url: '/section'
|
16
|
+
- title: 'Sub-section'
|
17
|
+
url: '/section/sub-section'
|
18
|
+
inverse:
|
19
|
+
description: On a dark background, such as the header of topic pages
|
20
|
+
data:
|
21
|
+
breadcrumbs:
|
22
|
+
- title: 'Section'
|
23
|
+
url: '/section'
|
24
|
+
- title: 'Sub-section'
|
25
|
+
url: '/section/sub-section'
|
26
|
+
title: 'Education of disadvantaged children'
|
27
|
+
is_current_page: true
|
28
|
+
inverse: true
|
29
|
+
context:
|
30
|
+
dark_background: true
|
31
|
+
no_breadcrumbs:
|
32
|
+
data:
|
33
|
+
breadcrumbs: []
|
34
|
+
single_section:
|
35
|
+
data:
|
36
|
+
breadcrumbs:
|
37
|
+
- title: 'Section'
|
38
|
+
url: '/section'
|
39
|
+
many_breadcrumbs:
|
40
|
+
data:
|
41
|
+
breadcrumbs:
|
42
|
+
- title: 'Home'
|
43
|
+
url: '/'
|
44
|
+
- title: 'Section'
|
45
|
+
url: '/section'
|
46
|
+
- title: 'Sub-section'
|
47
|
+
url: '/section/sub-section'
|
48
|
+
- title: 'Sub Sub-section'
|
49
|
+
url: '/section/sub-section/sub-sub-section'
|
50
|
+
no_home:
|
51
|
+
data:
|
52
|
+
breadcrumbs:
|
53
|
+
- title: 'Service Manual'
|
54
|
+
url: '/service-manual'
|
55
|
+
- title: 'Agile Delivery'
|
56
|
+
url: '/service-manual/agile-delivery'
|
57
|
+
real:
|
58
|
+
data:
|
59
|
+
breadcrumbs:
|
60
|
+
- title: 'Home'
|
61
|
+
url: '/'
|
62
|
+
- title: 'Passports, travel and living abroad'
|
63
|
+
url: '/browse/abroad'
|
64
|
+
- title: 'Travel abroad'
|
65
|
+
url: '/browse/abroad/travel-abroad'
|
66
|
+
last_breadcrumb_is_current_page:
|
67
|
+
data:
|
68
|
+
breadcrumbs:
|
69
|
+
- title: 'Home'
|
70
|
+
url: '/'
|
71
|
+
- title: 'Passports, travel and living abroad'
|
72
|
+
url: '/browse/abroad'
|
73
|
+
- title: 'Travel abroad'
|
74
|
+
highlight_current_page:
|
75
|
+
description: This is currently used on pages tagged to the taxonomy, such as [on this page](https://www.gov.uk/guidance/pupil-premium-information-for-schools-and-alternative-provision-settings).
|
76
|
+
data:
|
77
|
+
breadcrumbs:
|
78
|
+
- title: 'Home'
|
79
|
+
url: '/'
|
80
|
+
- title: 'Education, training and skills'
|
81
|
+
url: '/education'
|
82
|
+
- title: 'Education of disadvantaged children'
|
83
|
+
is_current_page: true
|
84
|
+
collapse_on_mobile:
|
85
|
+
description: This is currently used within on pages tagged to the taxonomy, such as [on this page](https://www.gov.uk/guidance/pupil-premium-information-for-schools-and-alternative-provision-settings).
|
86
|
+
data:
|
87
|
+
collapse_on_mobile: true
|
88
|
+
breadcrumbs:
|
89
|
+
- title: 'Home'
|
90
|
+
url: '/'
|
91
|
+
- title: 'Education, training and skills'
|
92
|
+
url: '/education'
|
93
|
+
is_page_parent: true
|
94
|
+
- title: 'Education of disadvantaged children'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
name: Heading
|
2
2
|
description: A text heading
|
3
3
|
body: |
|
4
|
-
A heading tag
|
4
|
+
A versatile heading tag component, including options for different heading levels and font sizes.
|
5
5
|
|
6
6
|
Real world examples:
|
7
7
|
|
@@ -17,16 +17,55 @@ examples:
|
|
17
17
|
default:
|
18
18
|
data:
|
19
19
|
text: 'Download the full outcome'
|
20
|
+
specific_heading_level:
|
21
|
+
data:
|
22
|
+
text: 'Original consultation'
|
23
|
+
heading_level: 3
|
24
|
+
different_font_sizes:
|
25
|
+
description: Choose a different font size. Valid options are 24 (24px) and 19 (19px), with the component defaulting to 27px, appropriate for a H1. This option is not tied to the heading_level option in order to give flexibility.
|
26
|
+
data:
|
27
|
+
text: 'Heading 3'
|
28
|
+
font_size: 19
|
29
|
+
with_id_attribute:
|
30
|
+
data:
|
31
|
+
text: 'Detail of outcome'
|
32
|
+
id: 'detail_of_outcome'
|
20
33
|
right_to_left:
|
21
34
|
data:
|
22
35
|
text: 'مستندات'
|
23
36
|
context:
|
24
37
|
right_to_left: true
|
25
|
-
|
38
|
+
with_padding:
|
39
|
+
description:
|
26
40
|
data:
|
27
|
-
text: '
|
28
|
-
|
29
|
-
|
41
|
+
text: 'Padded'
|
42
|
+
padding: true
|
43
|
+
with_margin:
|
44
|
+
description: |
|
45
|
+
Configurable bottom margin for the component. This has been built in anticipation of being compatible with a theoretical future model for component margins.
|
46
|
+
|
47
|
+
Accepted parameters for this option are 2 (gives a margin of gutter-half) and 4 (gutter). See the Sass file for more detail.
|
30
48
|
data:
|
31
|
-
text: '
|
32
|
-
|
49
|
+
text: 'Really big bottom margin'
|
50
|
+
margin_bottom: 4
|
51
|
+
with_mobile_top_margin:
|
52
|
+
description: |
|
53
|
+
On publications and consultations the layout of the page requires that the heading component have spacing above it on mobile. Since this is a specific use case, this is now an option on the component rather than the default behaviour.
|
54
|
+
|
55
|
+
It is intended that this option will ultimately be deprecated once more of the frontend is componentised and a general component model of margins is implemented.
|
56
|
+
data:
|
57
|
+
text: 'Consultation description'
|
58
|
+
mobile_top_margin: true
|
59
|
+
with_border:
|
60
|
+
description: A top border can be applied to the component of different thicknesses. Accepted values are 1 (1px), 2 (2px) and 5 (5px). Note that this works best with padding applied.
|
61
|
+
data:
|
62
|
+
text: 'With a border'
|
63
|
+
padding: true
|
64
|
+
border_top: 2
|
65
|
+
with_branding:
|
66
|
+
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, if a top border is included.
|
67
|
+
data:
|
68
|
+
text: 'Branding'
|
69
|
+
brand: 'department-for-environment-food-rural-affairs'
|
70
|
+
padding: true
|
71
|
+
border_top: 5
|
@@ -43,13 +43,13 @@ examples:
|
|
43
43
|
data:
|
44
44
|
padding_top: false
|
45
45
|
block: |
|
46
|
-
<div class="
|
46
|
+
<div class="gem-c-breadcrumbs " data-module="track-click">
|
47
47
|
<ol>
|
48
48
|
<li class="">
|
49
|
-
<a data-track-category="breadcrumbClicked" data-track-action="1" data-track-label="/section" data-track-options="{"dimension28":"2","dimension29":"Section"}" class="
|
49
|
+
<a data-track-category="breadcrumbClicked" data-track-action="1" data-track-label="/section" data-track-options="{"dimension28":"2","dimension29":"Section"}" class="gem-c-breadcrumbs--inverse" aria-current="false" href="/section">Section</a>
|
50
50
|
</li>
|
51
51
|
<li class="">
|
52
|
-
<a data-track-category="breadcrumbClicked" data-track-action="2" data-track-label="#content" data-track-options="{"dimension28":"2","dimension29":"Education of disadvantaged children"}" class="
|
52
|
+
<a data-track-category="breadcrumbClicked" data-track-action="2" data-track-label="#content" data-track-options="{"dimension28":"2","dimension29":"Education of disadvantaged children"}" class="gem-c-breadcrumbs--inverse gem-c-breadcrumbs--current " aria-current="page" href="#content">Education of disadvantaged children</a>
|
53
53
|
</li>
|
54
54
|
</ol>
|
55
55
|
</div>
|
@@ -23,13 +23,3 @@ examples:
|
|
23
23
|
links:
|
24
24
|
world_locations:
|
25
25
|
- analytics_identifier: WL3
|
26
|
-
with_default_canonical_path:
|
27
|
-
data:
|
28
|
-
content_item:
|
29
|
-
base_path: /test
|
30
|
-
canonical_path: true
|
31
|
-
with_overridden_canonical_path:
|
32
|
-
data:
|
33
|
-
content_item:
|
34
|
-
base_path: /test
|
35
|
-
canonical_path: /this-is-a-test-path
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: Share links
|
2
|
+
description: Links to share the current page on Facebook or Twitter
|
3
|
+
body: |
|
4
|
+
Pass complete share URLs to the component. The component will not process a URL into a share link itself.
|
5
|
+
|
6
|
+
Use only with content that benefits from being shared, for example a consultation.
|
7
|
+
|
8
|
+
The component will track interactions with the share links to Google Analytics using [Social Interactions](https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions)
|
9
|
+
|
10
|
+
Real world examples:
|
11
|
+
|
12
|
+
- [News article](/government/news/fast-tracking-uk-innovation-apply-for-business-funding)
|
13
|
+
- [Consultation](/government/consultations/soft-drinks-industry-levy)
|
14
|
+
- [Right to left](/government/news/uk-sets-out-long-term-support-for-stable-secure-and-prosperous-afghanistan-to-2020.ur)
|
15
|
+
|
16
|
+
accessibility_criteria: |
|
17
|
+
The share link icons must be presentational and ignored by screen readers.
|
18
|
+
shared_accessibility_criteria:
|
19
|
+
- link
|
20
|
+
examples:
|
21
|
+
default:
|
22
|
+
data:
|
23
|
+
facebook_href: '/facebook-link'
|
24
|
+
twitter_href: '/twitter-link'
|
25
|
+
with_custom_text:
|
26
|
+
data:
|
27
|
+
title: 'Share this news article'
|
28
|
+
facebook_href: '/facebook-share-link'
|
29
|
+
twitter_href: '/twitter-share-link'
|
30
|
+
with_only_one_link_provided:
|
31
|
+
data:
|
32
|
+
facebook_href: '/only-facebook-link'
|
33
|
+
right_to_left:
|
34
|
+
data:
|
35
|
+
facebook_href: '/facebook-link'
|
36
|
+
twitter_href: '/twitter-link'
|
37
|
+
context:
|
38
|
+
right_to_left: true
|
@@ -37,3 +37,32 @@ examples:
|
|
37
37
|
data:
|
38
38
|
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
39
39
|
feed_link_box_value: 'https://www.gov.uk/government/organisations/attorney-generals-office.atom'
|
40
|
+
with_branding:
|
41
|
+
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.
|
42
|
+
data:
|
43
|
+
brand: 'attorney-generals-office'
|
44
|
+
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
45
|
+
feed_link: '/foreign-travel-advice/singapore.atom'
|
46
|
+
with_tracking:
|
47
|
+
description: Data attributes can be passed for each link as shown.
|
48
|
+
data:
|
49
|
+
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
50
|
+
email_signup_link_data_attributes: {
|
51
|
+
track_category: 'email_link_category',
|
52
|
+
track_action: 1.1,
|
53
|
+
track_label: 'email_link_label',
|
54
|
+
track_options: {
|
55
|
+
dimension28: 1,
|
56
|
+
dimension29: 'dimension29EmailLink'
|
57
|
+
}
|
58
|
+
}
|
59
|
+
feed_link_box_value: 'https://www.gov.uk/government/organisations/attorney-generals-office.atom'
|
60
|
+
feed_link_data_attributes: {
|
61
|
+
track_category: 'feed_link_category',
|
62
|
+
track_action: 1.2,
|
63
|
+
track_label: 'feed_link_label',
|
64
|
+
track_options: {
|
65
|
+
dimension28: 7,
|
66
|
+
dimension29: 'dimension29feedLink'
|
67
|
+
}
|
68
|
+
}
|
@@ -59,3 +59,41 @@ examples:
|
|
59
59
|
active: true
|
60
60
|
context:
|
61
61
|
right_to_left: true
|
62
|
+
with_branding:
|
63
|
+
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.
|
64
|
+
data:
|
65
|
+
brand: 'wales-office'
|
66
|
+
translations:
|
67
|
+
- locale: 'en'
|
68
|
+
base_path: '/en'
|
69
|
+
text: 'English'
|
70
|
+
active: true
|
71
|
+
- locale: 'cy'
|
72
|
+
base_path: '/cy'
|
73
|
+
text: 'Cymraeg'
|
74
|
+
with_tracking:
|
75
|
+
description: Data attributes can be passed for each link as shown.
|
76
|
+
data:
|
77
|
+
translations:
|
78
|
+
- locale: 'en'
|
79
|
+
base_path: '/en'
|
80
|
+
text: 'English'
|
81
|
+
active: true
|
82
|
+
data_attributes:
|
83
|
+
track_category: 'categoryEnglish'
|
84
|
+
track_action: 1.1
|
85
|
+
track_label: 'labelEnglish'
|
86
|
+
track_options:
|
87
|
+
dimension28: 1
|
88
|
+
dimension29: 'dimension29English'
|
89
|
+
- locale: 'cy'
|
90
|
+
base_path: '/cy'
|
91
|
+
text: 'Cymraeg'
|
92
|
+
data_attributes:
|
93
|
+
track_category: 'categoryWelsh'
|
94
|
+
track_action: 1.2
|
95
|
+
track_label: 'labelWelsh'
|
96
|
+
track_options:
|
97
|
+
dimension28: 1
|
98
|
+
dimension29: 'dimension29Welsh'
|
99
|
+
|
@@ -36,7 +36,7 @@
|
|
36
36
|
</div>
|
37
37
|
|
38
38
|
<main id="wrapper" class="govuk-component-guide-wrapper">
|
39
|
-
<%= render '
|
39
|
+
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: @guide_breadcrumbs %>
|
40
40
|
<% else %>
|
41
41
|
<main id="wrapper">
|
42
42
|
<% end %>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "govuk_publishing_components/config"
|
2
2
|
require "govuk_publishing_components/engine"
|
3
|
+
require "govuk_publishing_components/presenters/breadcrumbs"
|
3
4
|
require "govuk_publishing_components/presenters/contextual_navigation"
|
4
5
|
require "govuk_publishing_components/presenters/related_navigation_helper"
|
5
6
|
require "govuk_publishing_components/presenters/step_by_step_nav_helper"
|
@@ -12,6 +13,9 @@ require "govuk_publishing_components/presenters/taxonomy_navigation"
|
|
12
13
|
require "govuk_publishing_components/presenters/rummager_taxonomy_sidebar_links"
|
13
14
|
require "govuk_publishing_components/presenters/curated_taxonomy_sidebar_links"
|
14
15
|
require "govuk_publishing_components/presenters/content_item"
|
16
|
+
require "govuk_publishing_components/presenters/translation_nav_helper"
|
17
|
+
require "govuk_publishing_components/presenters/subscription_links_helper"
|
18
|
+
require "govuk_publishing_components/presenters/heading_helper"
|
15
19
|
|
16
20
|
require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
|
17
21
|
require "govuk_publishing_components/app_helpers/brand_helper"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class Breadcrumbs
|
4
|
+
def initialize(breadcrumbs, request_path)
|
5
|
+
@breadcrumbs = breadcrumbs
|
6
|
+
@request_path = request_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def structured_data
|
10
|
+
{
|
11
|
+
"@context" => "http://schema.org",
|
12
|
+
"@type" => "BreadcrumbList",
|
13
|
+
"itemListElement" => item_list_element,
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_reader :breadcrumbs, :request_path
|
20
|
+
|
21
|
+
def item_list_element
|
22
|
+
breadcrumbs.each_with_index.map do |crumb, index|
|
23
|
+
{
|
24
|
+
"@type" => "ListItem",
|
25
|
+
"position" => index + 1,
|
26
|
+
"item" => list_item_item(crumb)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def list_item_item(crumb)
|
32
|
+
path = crumb[:is_current_page] ? request_path : crumb[:url]
|
33
|
+
item = { "name" => crumb[:title] }
|
34
|
+
item["@id"] = Plek.new.website_root + path if path
|
35
|
+
item
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class HeadingHelper
|
4
|
+
attr_reader :heading_tag, :id, :classes
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@heading_tag = "h1"
|
8
|
+
@heading_tag = "h#{options[:heading_level]}" if [1, 2, 3, 4, 5, 6].include? options[:heading_level]
|
9
|
+
@id = options[:id]
|
10
|
+
|
11
|
+
@classes = ""
|
12
|
+
@classes << " gem-c-heading--font-size-#{options[:font_size]}" if [24, 19].include? options[:font_size]
|
13
|
+
@classes << " gem-c-heading--mobile-top-margin" if options[:mobile_top_margin]
|
14
|
+
@classes << " gem-c-heading--padding" if options[:padding]
|
15
|
+
@classes << " gem-c-heading--margin-bottom-#{options[:margin_bottom]}" if [2, 4].include? options[:margin_bottom]
|
16
|
+
@classes << " gem-c-heading--border-top-#{options[:border_top]}" if [1, 2, 5].include? options[:border_top]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -20,7 +20,6 @@ module GovukPublishingComponents
|
|
20
20
|
meta_tags = add_political_tags(meta_tags)
|
21
21
|
meta_tags = add_taxonomy_tags(meta_tags)
|
22
22
|
meta_tags = add_step_by_step_tags(meta_tags)
|
23
|
-
meta_tags = add_canonical_tag(meta_tags)
|
24
23
|
meta_tags
|
25
24
|
end
|
26
25
|
|
@@ -107,20 +106,6 @@ module GovukPublishingComponents
|
|
107
106
|
meta_tags
|
108
107
|
end
|
109
108
|
|
110
|
-
def add_canonical_tag(meta_tags)
|
111
|
-
if local_assigns.key?(:canonical_path)
|
112
|
-
canonical_path = if local_assigns[:canonical_path] == true
|
113
|
-
content_item[:base_path]
|
114
|
-
else
|
115
|
-
local_assigns[:canonical_path]
|
116
|
-
end
|
117
|
-
|
118
|
-
meta_tags["canonical"] = Plek.new.website_root + canonical_path
|
119
|
-
end
|
120
|
-
|
121
|
-
meta_tags
|
122
|
-
end
|
123
|
-
|
124
109
|
def has_content_history?
|
125
110
|
(content_item[:public_updated_at] && details[:first_public_at] && content_item[:public_updated_at] != details[:first_public_at]) ||
|
126
111
|
(details[:change_history] && details[:change_history].size > 1)
|
@@ -84,7 +84,12 @@ module GovukPublishingComponents
|
|
84
84
|
if link[:href]
|
85
85
|
@link_index += 1
|
86
86
|
href = link_href(link[:active], link[:href])
|
87
|
-
|
87
|
+
|
88
|
+
text = capture do
|
89
|
+
concat link_text(link[:active], link[:text])
|
90
|
+
concat " "
|
91
|
+
concat create_context(link[:context])
|
92
|
+
end
|
88
93
|
|
89
94
|
link_to(
|
90
95
|
href,
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class SubscriptionLinksHelper
|
4
|
+
attr_reader :feed_box_id, :email_signup_link, :email_signup_link_data_attributes, :feed_link_box_value
|
5
|
+
|
6
|
+
def initialize(local_assigns)
|
7
|
+
@local_assigns = local_assigns
|
8
|
+
@feed_box_id = "feed-reader-#{SecureRandom.hex(2)}"
|
9
|
+
@email_signup_link = @local_assigns[:email_signup_link]
|
10
|
+
@email_signup_link_data_attributes = @local_assigns[:email_signup_link_data_attributes]
|
11
|
+
@feed_link_box_value = @local_assigns[:feed_link_box_value]
|
12
|
+
end
|
13
|
+
|
14
|
+
def email_signup_link_text
|
15
|
+
return @local_assigns[:email_signup_link_text] if @local_assigns[:email_signup_link_text]
|
16
|
+
I18n.t("govuk_component.subscription_links.email_signup_link_text", default: "Get email alerts")
|
17
|
+
end
|
18
|
+
|
19
|
+
def feed_link_text
|
20
|
+
return @local_assigns[:feed_link_text] if @local_assigns[:feed_link_text]
|
21
|
+
I18n.t("govuk_component.subscription_links.feed_link_text", default: "Subscribe to feed")
|
22
|
+
end
|
23
|
+
|
24
|
+
def component_data_is_valid?
|
25
|
+
email_signup_link.present? || feed_link.present? || feed_link_box_value.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
def tracking_is_present?
|
29
|
+
@local_assigns[:email_signup_link_data_attributes].present? || @local_assigns[:feed_link_data_attributes].present?
|
30
|
+
end
|
31
|
+
|
32
|
+
def feed_link
|
33
|
+
return "#" if feed_link_box_value
|
34
|
+
@local_assigns[:feed_link]
|
35
|
+
end
|
36
|
+
|
37
|
+
def feed_link_data_attributes
|
38
|
+
data = @local_assigns[:feed_link_data_attributes] || {}
|
39
|
+
data[:controls] = feed_box_id
|
40
|
+
data[:expanded] = "false"
|
41
|
+
data
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class TranslationNavHelper
|
4
|
+
attr_reader :translations
|
5
|
+
|
6
|
+
def initialize(local_assigns)
|
7
|
+
@translations = []
|
8
|
+
@translations = local_assigns[:translations] if local_assigns[:translations]
|
9
|
+
end
|
10
|
+
|
11
|
+
def has_translations?
|
12
|
+
true if @translations.length > 1
|
13
|
+
end
|
14
|
+
|
15
|
+
def tracking_is_present?
|
16
|
+
@translations.each do |translation|
|
17
|
+
return true if translation[:data_attributes]
|
18
|
+
end
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
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:
|
4
|
+
version: 8.0.0
|
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: 2018-05-
|
11
|
+
date: 2018-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -319,12 +319,14 @@ files:
|
|
319
319
|
- app/assets/javascripts/govuk_publishing_components/lib/history-support.js
|
320
320
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
|
321
321
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle.js
|
322
|
+
- app/assets/javascripts/govuk_publishing_components/lib/track-share-button-clicks.js
|
322
323
|
- app/assets/stylesheets/component_guide/all_components.scss
|
323
324
|
- app/assets/stylesheets/component_guide/all_components_print.scss
|
324
325
|
- app/assets/stylesheets/component_guide/application.scss
|
325
326
|
- app/assets/stylesheets/govuk_publishing_components/_all_components.scss
|
326
327
|
- app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss
|
327
328
|
- app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss
|
329
|
+
- app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss
|
328
330
|
- app/assets/stylesheets/govuk_publishing_components/components/_button.scss
|
329
331
|
- app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss
|
330
332
|
- app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss
|
@@ -337,6 +339,7 @@ files:
|
|
337
339
|
- app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
|
338
340
|
- app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss
|
339
341
|
- app/assets/stylesheets/govuk_publishing_components/components/_search.scss
|
342
|
+
- app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss
|
340
343
|
- app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss
|
341
344
|
- app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss
|
342
345
|
- app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss
|
@@ -344,12 +347,14 @@ files:
|
|
344
347
|
- app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss
|
345
348
|
- app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-navigation.scss
|
346
349
|
- app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss
|
347
|
-
- app/assets/stylesheets/govuk_publishing_components/components/helpers/
|
350
|
+
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss
|
348
351
|
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_px-to-em.scss
|
349
352
|
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss
|
353
|
+
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_back-arrow.scss
|
350
354
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_clearfix.scss
|
351
355
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss
|
352
356
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_media-down.scss
|
357
|
+
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_touch-friendly-links.scss
|
353
358
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_feedback.scss
|
354
359
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss
|
355
360
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss
|
@@ -368,6 +373,7 @@ files:
|
|
368
373
|
- app/views/govuk_publishing_components/component_guide/preview.html.erb
|
369
374
|
- app/views/govuk_publishing_components/component_guide/show.html.erb
|
370
375
|
- app/views/govuk_publishing_components/components/_back_link.html.erb
|
376
|
+
- app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
|
371
377
|
- app/views/govuk_publishing_components/components/_button.html.erb
|
372
378
|
- app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb
|
373
379
|
- app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb
|
@@ -383,6 +389,7 @@ files:
|
|
383
389
|
- app/views/govuk_publishing_components/components/_radio.html.erb
|
384
390
|
- app/views/govuk_publishing_components/components/_related_navigation.html.erb
|
385
391
|
- app/views/govuk_publishing_components/components/_search.html.erb
|
392
|
+
- app/views/govuk_publishing_components/components/_share_links.html.erb
|
386
393
|
- app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb
|
387
394
|
- app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb
|
388
395
|
- app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb
|
@@ -391,6 +398,7 @@ files:
|
|
391
398
|
- app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb
|
392
399
|
- app/views/govuk_publishing_components/components/_translation-nav.html.erb
|
393
400
|
- app/views/govuk_publishing_components/components/docs/back_link.yml
|
401
|
+
- app/views/govuk_publishing_components/components/docs/breadcrumbs.yml
|
394
402
|
- app/views/govuk_publishing_components/components/docs/button.yml
|
395
403
|
- app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml
|
396
404
|
- app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml
|
@@ -406,6 +414,7 @@ files:
|
|
406
414
|
- app/views/govuk_publishing_components/components/docs/radio.yml
|
407
415
|
- app/views/govuk_publishing_components/components/docs/related_navigation.yml
|
408
416
|
- app/views/govuk_publishing_components/components/docs/search.yml
|
417
|
+
- app/views/govuk_publishing_components/components/docs/share_links.yml
|
409
418
|
- app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml
|
410
419
|
- app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml
|
411
420
|
- app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml
|
@@ -430,18 +439,22 @@ files:
|
|
430
439
|
- lib/govuk_publishing_components/config.rb
|
431
440
|
- lib/govuk_publishing_components/engine.rb
|
432
441
|
- lib/govuk_publishing_components/minitest/component_guide_test.rb
|
442
|
+
- lib/govuk_publishing_components/presenters/breadcrumbs.rb
|
433
443
|
- lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_parent.rb
|
434
444
|
- lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb
|
435
445
|
- lib/govuk_publishing_components/presenters/content_item.rb
|
436
446
|
- lib/govuk_publishing_components/presenters/contextual_navigation.rb
|
437
447
|
- lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb
|
448
|
+
- lib/govuk_publishing_components/presenters/heading_helper.rb
|
438
449
|
- lib/govuk_publishing_components/presenters/meta_tags.rb
|
439
450
|
- lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb
|
440
451
|
- lib/govuk_publishing_components/presenters/related_navigation_helper.rb
|
441
452
|
- lib/govuk_publishing_components/presenters/rummager_taxonomy_sidebar_links.rb
|
442
453
|
- lib/govuk_publishing_components/presenters/services.rb
|
443
454
|
- lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
|
455
|
+
- lib/govuk_publishing_components/presenters/subscription_links_helper.rb
|
444
456
|
- lib/govuk_publishing_components/presenters/taxonomy_navigation.rb
|
457
|
+
- lib/govuk_publishing_components/presenters/translation_nav_helper.rb
|
445
458
|
- lib/govuk_publishing_components/version.rb
|
446
459
|
- lib/tasks/govuk_publishing_components_tasks.rake
|
447
460
|
homepage: https://github.com/alphagov/govuk_publishing_components
|