govuk_publishing_components 8.2.0 → 9.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/images/govuk_publishing_components/govuk-logo.png +0 -0
- data/app/assets/images/govuk_publishing_components/icon-pointer-2x.png +0 -0
- data/app/assets/images/govuk_publishing_components/icon-pointer.png +0 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +3 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +70 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +134 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +29 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +123 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +33 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +15 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss +34 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +111 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +11 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_call-to-action.scss +25 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +306 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +49 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_example.scss +25 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +27 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_fraction.scss +22 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +42 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_images.scss +32 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_information-callout.scss +22 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_legislative-list.scss +26 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_media-player.scss +15 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +29 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +29 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +24 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_summary.scss +24 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +38 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +224 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +41 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/form-download.scss +24 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_contents-list-helper.scss +25 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_contents-list.scss +19 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak-html-publication.scss +5 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +65 -0
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +84 -0
- data/app/views/govuk_publishing_components/components/_govspeak.html.erb +14 -0
- data/app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb +9 -0
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +41 -0
- data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/_notice.html.erb +22 -0
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +68 -30
- data/app/views/govuk_publishing_components/components/docs/contents_list.yml +218 -0
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +653 -0
- data/app/views/govuk_publishing_components/components/docs/govspeak_html_publication.yml +183 -0
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +160 -0
- data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/machine_readable_metadata.yml +17 -1
- data/app/views/govuk_publishing_components/components/docs/notice.yml +27 -0
- data/app/views/govuk_publishing_components/components/docs/share_links.yml +119 -18
- data/config/initializers/assets.rb +3 -0
- data/config/locales/en.yml +2 -0
- data/lib/govuk_publishing_components.rb +2 -1
- data/lib/govuk_publishing_components/presenters/contents_list_helper.rb +27 -0
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +55 -0
- data/lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb +5 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/page.rb +5 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/person_schema.rb +39 -0
- data/lib/govuk_publishing_components/presenters/schema_org.rb +3 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +49 -4
- data/app/assets/javascripts/govuk_publishing_components/lib/track-share-button-clicks.js +0 -26
- data/lib/govuk_publishing_components/presenters/sanitisation.rb +0 -13
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
// Govspeak warning callout
|
2
|
+
// https://govuk-static.herokuapp.com/component-guide/govspeak/warning_callout
|
3
|
+
//
|
4
|
+
// Support:
|
5
|
+
//
|
6
|
+
// - alphagov/whitehall: ✔︎
|
7
|
+
// - alphagov/govspeak: ✔︎
|
8
|
+
|
9
|
+
.gem-c-govspeak {
|
10
|
+
.help-notice {
|
11
|
+
$icon-size: 34px;
|
12
|
+
$line-height-mobile: 20px;
|
13
|
+
$line-height-tablet: 25px;
|
14
|
+
|
15
|
+
margin: 2em 0;
|
16
|
+
|
17
|
+
// Add '!' icon
|
18
|
+
background-image: image-url("icon-important.png");
|
19
|
+
background-size: $icon-size $icon-size;
|
20
|
+
background-repeat: no-repeat;
|
21
|
+
|
22
|
+
@include device-pixel-ratio() {
|
23
|
+
background-image: image-url("icon-important-2x.png");
|
24
|
+
}
|
25
|
+
|
26
|
+
min-height: $icon-size;
|
27
|
+
padding-left: $icon-size;
|
28
|
+
|
29
|
+
// Center the icon around the baseline
|
30
|
+
padding-top: ($icon-size - $line-height-mobile) / 2;
|
31
|
+
|
32
|
+
@include media(tablet) {
|
33
|
+
padding-top: ($icon-size - $line-height-tablet) / 2;
|
34
|
+
}
|
35
|
+
|
36
|
+
p {
|
37
|
+
@include bold-19;
|
38
|
+
margin-left: 1em;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/form-download.scss
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
.gem-c-govspeak .form-download {
|
2
|
+
padding: 0.25em 0;
|
3
|
+
|
4
|
+
@include media-down(mobile) {
|
5
|
+
margin: 1em 0 1.5em;
|
6
|
+
}
|
7
|
+
|
8
|
+
p {
|
9
|
+
padding-right: 3em;
|
10
|
+
}
|
11
|
+
|
12
|
+
a {
|
13
|
+
display: block;
|
14
|
+
font-weight: 600;
|
15
|
+
background: image-url("icon-file-download.png") no-repeat scroll 0 0;
|
16
|
+
min-height: 2.5em;
|
17
|
+
padding: 0 0 0 2.5em;
|
18
|
+
|
19
|
+
@include device-pixel-ratio() {
|
20
|
+
background-image: image-url("icon-file-download-2x.png");
|
21
|
+
background-size: 25px 25px;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// Contents list helper is used in both print and screen stylesheets
|
2
|
+
.gem-c-contents-list__list-item--numbered {
|
3
|
+
.gem-c-contents-list__link {
|
4
|
+
display: table;
|
5
|
+
}
|
6
|
+
}
|
7
|
+
|
8
|
+
.gem-c-contents-list__number,
|
9
|
+
.gem-c-contents-list__numbered-text {
|
10
|
+
display: table-cell;
|
11
|
+
}
|
12
|
+
|
13
|
+
.gem-c-contents-list__number {
|
14
|
+
min-width: 1.5em;
|
15
|
+
}
|
16
|
+
|
17
|
+
.gem-c-contents-list__numbered-text {
|
18
|
+
$contents-text-padding: 0.3em;
|
19
|
+
padding-left: $contents-text-padding;
|
20
|
+
|
21
|
+
.direction-rtl & {
|
22
|
+
padding-left: 0;
|
23
|
+
padding-right: $contents-text-padding;
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@import "../helpers/contents-list-helper";
|
2
|
+
|
3
|
+
// Override default browser indentation
|
4
|
+
.gem-c-contents-list__list,
|
5
|
+
.gem-c-contents-list__nested-list {
|
6
|
+
padding-left: 0;
|
7
|
+
margin-left: 0;
|
8
|
+
}
|
9
|
+
|
10
|
+
// Put indentation back where we use list style types
|
11
|
+
.gem-c-contents-list__list-item--dashed {
|
12
|
+
margin-left: $gutter / 2;
|
13
|
+
list-style-type: disc;
|
14
|
+
}
|
15
|
+
|
16
|
+
.gem-c-contents-list__list-item--numbered,
|
17
|
+
.gem-c-contents-list__list-item--parent {
|
18
|
+
list-style-type: none;
|
19
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
.gem-c-govspeak {
|
2
|
+
.media-player {
|
3
|
+
display: none;
|
4
|
+
}
|
5
|
+
|
6
|
+
.info-notice,
|
7
|
+
.help-notice,
|
8
|
+
.call-to-action {
|
9
|
+
margin: $gutter-half 0;
|
10
|
+
padding: 0 $gutter-half;
|
11
|
+
border: 1pt solid $border-colour;
|
12
|
+
}
|
13
|
+
|
14
|
+
.help-notice p {
|
15
|
+
font-weight: 700;
|
16
|
+
}
|
17
|
+
|
18
|
+
.fraction {
|
19
|
+
img {
|
20
|
+
display: inline-block;
|
21
|
+
margin-bottom: -7px;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.attachment {
|
26
|
+
margin: $gutter 0;
|
27
|
+
|
28
|
+
&:first-child {
|
29
|
+
margin-top: 0;
|
30
|
+
}
|
31
|
+
|
32
|
+
.attachment-thumb {
|
33
|
+
display: none;
|
34
|
+
}
|
35
|
+
|
36
|
+
.attachment-details {
|
37
|
+
.download {
|
38
|
+
display: block;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
.accessibility-warning {
|
43
|
+
h2 {
|
44
|
+
@include core-14;
|
45
|
+
}
|
46
|
+
|
47
|
+
.toggler {
|
48
|
+
display: none;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
.footnotes {
|
54
|
+
border-top: 1px solid $text-colour;
|
55
|
+
}
|
56
|
+
|
57
|
+
.legislative-list {
|
58
|
+
padding-left: 0;
|
59
|
+
|
60
|
+
&,
|
61
|
+
ol {
|
62
|
+
list-style: none;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
<div class="component-show">
|
5
5
|
<div class="component-doc">
|
6
|
-
<%= render "
|
6
|
+
<%= render "govuk_publishing_components/components/govspeak", content: @component_example.html_description %>
|
7
7
|
<h2 class="component-doc-h2">How to call this example</h2>
|
8
8
|
<%= render partial: "govuk_publishing_components/component_guide/component_doc/call", locals: { component_doc: @component_doc, example: @component_example } %>
|
9
9
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= render 'govuk_publishing_components/components/title', title: GovukPublishingComponents::Config.component_guide_title %>
|
2
2
|
|
3
|
-
<div class="
|
3
|
+
<div class="gem-c-govspeak">
|
4
4
|
<p>Components are packages of template, style, behaviour and documentation that live in your application.</p>
|
5
5
|
<p>A component must:</p>
|
6
6
|
<ul>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%= render 'govuk_publishing_components/components/lead_paragraph', text: @component_doc.description %>
|
14
14
|
<% if @component_doc.body.present? %>
|
15
15
|
<div class="component-body">
|
16
|
-
<%= render '
|
16
|
+
<%= render 'govuk_publishing_components/components/govspeak', content: @component_doc.html_body %>
|
17
17
|
</div>
|
18
18
|
<% end %>
|
19
19
|
</div>
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<div class="grid-row component-accessibility-criteria">
|
33
33
|
<div class="column-two-thirds">
|
34
34
|
<h2 class="component-doc-h2">Accessibility acceptance criteria</h2>
|
35
|
-
<%= render '
|
35
|
+
<%= render 'govuk_publishing_components/components/govspeak', content: @component_doc.html_accessibility_criteria %>
|
36
36
|
</div>
|
37
37
|
</div>
|
38
38
|
<% end %>
|
@@ -48,7 +48,7 @@
|
|
48
48
|
<a href="<%= component_example_path(@component_doc.id, example.id) %>"><%= example.name %></a>
|
49
49
|
<small>(<a href="<%= component_preview_path(@component_doc.id, example.id) %>">preview</a>)</small>
|
50
50
|
</h3>
|
51
|
-
<%= render "
|
51
|
+
<%= render "govuk_publishing_components/components/govspeak", content: example.html_description %>
|
52
52
|
<%= render "govuk_publishing_components/component_guide/component_doc/call", component_doc: @component_doc, example: example %>
|
53
53
|
<%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, example: example %>
|
54
54
|
</div>
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<%
|
2
|
+
cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new
|
3
|
+
format_numbers ||= false
|
4
|
+
underline_links ||= false
|
5
|
+
contents ||= []
|
6
|
+
aria_label ||= ''
|
7
|
+
nested = !!contents.find { |c| c[:items] && c[:items].any? }
|
8
|
+
parent_list_item_modifier = if nested
|
9
|
+
'parent'
|
10
|
+
elsif format_numbers
|
11
|
+
'numbered'
|
12
|
+
else
|
13
|
+
'dashed'
|
14
|
+
end
|
15
|
+
brand ||= false
|
16
|
+
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
17
|
+
hide_title ||= false
|
18
|
+
%>
|
19
|
+
<% if contents.any? %>
|
20
|
+
<nav
|
21
|
+
role="navigation"
|
22
|
+
class="gem-c-contents-list <%= 'gem-c-contents-list--no-underline' unless underline_links %> <%= brand_helper.brand_class %>"
|
23
|
+
data-module="track-click"
|
24
|
+
<% if aria_label.present? %>
|
25
|
+
aria-label="<%= aria_label %>"
|
26
|
+
<% end %>
|
27
|
+
>
|
28
|
+
<% unless hide_title %>
|
29
|
+
<h2 class="gem-c-contents-list__title"><%= t("components.contents_list.contents") %></h2>
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
<ol class="gem-c-contents-list__list">
|
33
|
+
<% contents.each.with_index(1) do |contents_item, position| %>
|
34
|
+
<%
|
35
|
+
active_class = "gem-c-contents-list__list-item--active" if contents_item[:active]
|
36
|
+
aria_current = "aria-current = true" if contents_item[:active]
|
37
|
+
%>
|
38
|
+
<li
|
39
|
+
class="gem-c-contents-list__list-item gem-c-contents-list__list-item--<%= parent_list_item_modifier %> <%= active_class %>"
|
40
|
+
<%= aria_current %>
|
41
|
+
>
|
42
|
+
<% link_text = format_numbers ? cl_helper.wrap_numbers_with_spans(contents_item[:text]) : contents_item[:text] %>
|
43
|
+
<%= link_to_if !contents_item[:active], link_text, contents_item[:href],
|
44
|
+
class: "gem-c-contents-list__link #{brand_helper.color_class}",
|
45
|
+
data: {
|
46
|
+
track_category: 'contentsClicked',
|
47
|
+
track_action: "content_item #{position}",
|
48
|
+
track_label: contents_item[:href],
|
49
|
+
track_options: {
|
50
|
+
dimension29: contents_item[:text]
|
51
|
+
}
|
52
|
+
}
|
53
|
+
%>
|
54
|
+
<% if contents_item[:items] && contents_item[:items].any? %>
|
55
|
+
<ol class="gem-c-contents-list__nested-list">
|
56
|
+
<% contents_item[:items].each.with_index(1) do |nested_contents_item, nested_position| %>
|
57
|
+
<%
|
58
|
+
active_class = "gem-c-contents-list__list-item--active" if nested_contents_item[:active]
|
59
|
+
aria_current = "aria-current = true" if nested_contents_item[:active]
|
60
|
+
%>
|
61
|
+
<li
|
62
|
+
class="gem-c-contents-list__list-item gem-c-contents-list__list-item--dashed <%= active_class %>"
|
63
|
+
<%= aria_current %>
|
64
|
+
>
|
65
|
+
<%= link_to_if !nested_contents_item[:active], nested_contents_item[:text], nested_contents_item[:href],
|
66
|
+
class: "gem-c-contents-list__link #{brand_helper.color_class}",
|
67
|
+
data: {
|
68
|
+
track_category: 'contentsClicked',
|
69
|
+
track_action: "nested_content_item #{position}:#{nested_position}",
|
70
|
+
track_label: nested_contents_item[:href],
|
71
|
+
track_options: {
|
72
|
+
dimension29: nested_contents_item[:text]
|
73
|
+
}
|
74
|
+
}
|
75
|
+
%>
|
76
|
+
</li>
|
77
|
+
<% end %>
|
78
|
+
</ol>
|
79
|
+
<% end %>
|
80
|
+
</li>
|
81
|
+
<% end %>
|
82
|
+
</ol>
|
83
|
+
</nav>
|
84
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%
|
2
|
+
direction_class = "direction-#{direction}" if local_assigns.include?(:direction)
|
3
|
+
rich_govspeak = local_assigns.fetch(:rich_govspeak) if local_assigns.include?(:rich_govspeak)
|
4
|
+
disable_youtube_expansions = local_assigns.fetch(:disable_youtube_expansions) if local_assigns.include?(:disable_youtube_expansions)
|
5
|
+
|
6
|
+
classes = []
|
7
|
+
classes << direction_class if direction_class
|
8
|
+
classes << "rich-govspeak" if rich_govspeak
|
9
|
+
classes << "disable-youtube" if disable_youtube_expansions
|
10
|
+
%>
|
11
|
+
|
12
|
+
<div class="gem-c-govspeak govuk-govspeak <%= classes.join(" ") %>">
|
13
|
+
<%= raw content %>
|
14
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%
|
2
|
+
govspeak_locals = { content: content }
|
3
|
+
govspeak_locals[:direction] = local_assigns.fetch(:direction) if local_assigns.include?(:direction)
|
4
|
+
govspeak_locals[:rich_govspeak] = local_assigns.fetch(:rich_govspeak) if local_assigns.include?(:rich_govspeak)
|
5
|
+
govspeak_locals[:disable_youtube_expansions] = local_assigns.fetch(:disable_youtube_expansions) if local_assigns.include?(:disable_youtube_expansions)
|
6
|
+
%>
|
7
|
+
<div class="gem-c-govspeak-html-publication">
|
8
|
+
<%= render 'govuk_publishing_components/components/govspeak', govspeak_locals %>
|
9
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%
|
2
|
+
brand ||= false
|
3
|
+
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
4
|
+
card_helper = GovukPublishingComponents::Presenters::ImageCardHelper.new(local_assigns)
|
5
|
+
%>
|
6
|
+
<% if card_helper.href %>
|
7
|
+
<div class="gem-c-image-card <%= "gem-c-image-card--large" if card_helper.large %> <%= brand_helper.brand_class %>"
|
8
|
+
<%= "data-module=track-click" if card_helper.is_tracking? %>
|
9
|
+
>
|
10
|
+
<%= card_helper.image %>
|
11
|
+
|
12
|
+
<div class="gem-c-image-card__text-wrapper">
|
13
|
+
<%= card_helper.context %>
|
14
|
+
|
15
|
+
<% if card_helper.heading_text %>
|
16
|
+
<%= content_tag(card_helper.heading_tag,
|
17
|
+
class: "gem-c-image-card__title") do %>
|
18
|
+
<%= link_to card_helper.heading_text, card_helper.href,
|
19
|
+
class: "gem-c-image-card__title-link #{brand_helper.color_class}",
|
20
|
+
data: card_helper.href_data_attributes
|
21
|
+
%>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= card_helper.description %>
|
26
|
+
|
27
|
+
<% if card_helper.extra_links %>
|
28
|
+
<ul class="gem-c-image-card__list <%= "gem-c-image-card__list--indented" if not card_helper.extra_links_no_indent %>">
|
29
|
+
<% card_helper.extra_links.each do |link| %>
|
30
|
+
<li class="gem-c-image-card__list-item">
|
31
|
+
<%= link_to link[:text], link[:href],
|
32
|
+
class: brand_helper.color_class,
|
33
|
+
data: link[:data_attributes]
|
34
|
+
%>
|
35
|
+
</li>
|
36
|
+
<% end %>
|
37
|
+
</ul>
|
38
|
+
<% end %>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
@@ -1,9 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
text ||= ""
|
3
3
|
inverse ||= false
|
4
|
-
# Replace the space between the last 2 words with a non-breaking space, so
|
5
|
-
# we'll never have a dangling word in a paragraph.
|
6
|
-
text = GovukPublishingComponents::Presenters::Sanitisation.sub_safely(text, /\s([\w\.\?\!\:]+)$/, ' \1')
|
7
4
|
%>
|
8
5
|
|
9
6
|
<% if text.present? %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% if defined?(title) %>
|
2
|
+
<%
|
3
|
+
description_text ||= false
|
4
|
+
description_govspeak ||= false
|
5
|
+
margin_bottom_class = " gem-c-notice--bottom-margin" unless local_assigns[:margin_bottom]
|
6
|
+
%>
|
7
|
+
<section class="gem-c-notice<%= margin_bottom_class %>" aria-label="Notice" role="region">
|
8
|
+
<% if description_text || description_govspeak %>
|
9
|
+
<h2 class="gem-c-notice__title"><%= title %></h2>
|
10
|
+
<% else %>
|
11
|
+
<span class="gem-c-notice__title"><%= title %></span>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if description_text %>
|
15
|
+
<p class="gem-c-notice__description"><%= description_text %></p>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% if description_govspeak %>
|
19
|
+
<%= render 'govuk_publishing_components/components/govspeak', content: description_govspeak %>
|
20
|
+
<% end %>
|
21
|
+
</section>
|
22
|
+
<% end %>
|
@@ -1,36 +1,74 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
links ||= []
|
3
|
+
title ||= false
|
4
|
+
track_as_sharing ||= false
|
5
|
+
stacked ||= false
|
6
|
+
|
7
|
+
brand ||= false
|
8
|
+
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
5
9
|
%>
|
6
|
-
<% if
|
7
|
-
<div class="gem-c-share-links dont-print" data-module="
|
8
|
-
|
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 %>
|
10
|
+
<% if links.any? %>
|
11
|
+
<div class="gem-c-share-links dont-print <%= brand_helper.brand_class %> <%= 'gem-c-share-links--stacked' if stacked %>" data-module="track-click">
|
12
|
+
<% if title %>
|
13
|
+
<h2 class="gem-c-share-links__title"><%= title %></h2>
|
21
14
|
<% end %>
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
16
|
+
<ul class="gem-c-share-links__list">
|
17
|
+
<% links.each do |link| %>
|
18
|
+
<li class="gem-c-share-links__list-item">
|
19
|
+
<%
|
20
|
+
if track_as_sharing
|
21
|
+
track_options = {
|
22
|
+
'socialAction': 'share',
|
23
|
+
'socialNetwork': link[:icon],
|
24
|
+
'socialTarget': link[:href]
|
25
|
+
}
|
26
|
+
end
|
27
|
+
%>
|
28
|
+
<%= link_to link[:href],
|
29
|
+
target: "_blank",
|
30
|
+
rel: "noopener noreferrer",
|
31
|
+
data: {
|
32
|
+
'track-category': 'social media',
|
33
|
+
'track-action': link[:icon],
|
34
|
+
'track-options': track_options
|
35
|
+
},
|
36
|
+
class: "gem-c-share-links__link #{brand_helper.color_class}" do %>
|
37
|
+
<span class="gem-c-share-links__link__icon">
|
38
|
+
<% if link[:icon] == 'facebook' %>
|
39
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
40
|
+
<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"/>
|
41
|
+
<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"/>
|
42
|
+
</svg>
|
43
|
+
|
44
|
+
<% elsif link[:icon] == 'twitter' %>
|
45
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
46
|
+
<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"/>
|
47
|
+
<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"/>
|
48
|
+
</svg>
|
49
|
+
|
50
|
+
<% elsif link[:icon] == 'email' %>
|
51
|
+
<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="M34.983 18.76v12.48H15.016V18.76h19.967m2.496-2.496H12.52v17.472h24.959V16.264z"/><path fill="none" stroke="#FFF" stroke-width="2.496" stroke-miterlimit="10" d="M14.59 18.963L25 26.945l10.263-7.869"/></svg>
|
52
|
+
|
53
|
+
<% elsif link[:icon] == 'flickr' %>
|
54
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="9 9 32 32"><path fill="currentColor" d="M9 9h32v32H9V9z"/><defs><path d="M9 9h32v32H9z"/></defs><clipPath><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FFF" d="M23.72 25a5.76 5.76 0 1 1-11.52 0 5.76 5.76 0 1 1 11.52 0m14.08 0c0 3.182-2.578 5.76-5.76 5.76s-5.76-2.578-5.76-5.76a5.76 5.76 0 1 1 11.52 0"/></svg>
|
55
|
+
|
56
|
+
<% elsif link[:icon] == 'instagram' %>
|
57
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="9 9 32 32"><path fill="currentColor" d="M9 9h32v32H9V9z"/><defs><path d="M9 9h32v32H9z"/></defs><clipPath><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FFF" d="M25 28.2a3.204 3.204 0 0 1-3.2-3.2c0-1.764 1.436-3.2 3.2-3.2 1.765 0 3.2 1.436 3.2 3.2 0 1.765-1.435 3.2-3.2 3.2"/><defs><path d="M9 9h32v32H9z"/></defs><clipPath><use xlink:href="#c" overflow="visible"/></clipPath><path clip-path="url(#d)" fill="#FFF" d="M25 22.44c1.412 0 2.56 1.148 2.56 2.56s-1.147 2.56-2.56 2.56a2.561 2.561 0 0 1 0-5.12m0-1.28A3.844 3.844 0 0 0 21.16 25 3.844 3.844 0 0 0 25 28.84 3.845 3.845 0 0 0 28.84 25 3.844 3.844 0 0 0 25 21.16"/><defs><path d="M9 9h32v32H9z"/></defs><clipPath><use xlink:href="#e" overflow="visible"/></clipPath><path clip-path="url(#f)" fill="#FFF" d="M17.32 35.24c-1.555 0-2.56-1.005-2.56-2.561V17.373c0-1.611.981-2.613 2.56-2.613h15.36c1.58 0 2.561 1.002 2.561 2.613v15.36c0 1.522-1.005 2.507-2.561 2.507H17.32zM25 17.96c-3.881 0-7.04 3.159-7.04 7.04 0 3.881 3.159 7.04 7.04 7.04 3.881 0 7.04-3.159 7.04-7.04 0-3.881-3.159-7.04-7.04-7.04m7.36-2.56a2.243 2.243 0 0 0-2.24 2.24 2.243 2.243 0 0 0 2.24 2.24 2.241 2.241 0 0 0 0-4.48"/><defs><path d="M9 9h32v32H9z"/></defs><clipPath><use xlink:href="#g" overflow="visible"/></clipPath><path clip-path="url(#h)" fill="#FFF" d="M30.552 15.4a2.873 2.873 0 0 0-.704 3.648A7.64 7.64 0 0 0 25 17.319c-4.235 0-7.68 3.445-7.68 7.68 0 4.235 3.445 7.68 7.68 7.68 4.235 0 7.68-3.444 7.68-7.68a7.642 7.642 0 0 0-1.728-4.848 2.876 2.876 0 0 0 3.647-.703v13.285c0 1.169-.717 1.866-1.92 1.866H17.32c-1.22 0-1.92-.699-1.92-1.92V17.373c0-1.254.7-1.973 1.92-1.973h13.232m2.128-1.28H17.32c-1.92 0-3.2 1.28-3.2 3.253V32.68c0 1.92 1.28 3.2 3.2 3.2h15.36c1.92 0 3.2-1.28 3.2-3.146v-15.36c0-1.974-1.28-3.254-3.2-3.254m-.32 5.12a1.6 1.6 0 1 1-.001-3.2 1.6 1.6 0 0 1 .001 3.2M25 31.4a6.4 6.4 0 1 1 .002-12.802A6.4 6.4 0 0 1 25 31.4"/></svg>
|
58
|
+
|
59
|
+
<% elsif link[:icon] == 'linkedin' %>
|
60
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="9 9 32 32"><path fill="currentColor" d="M9 9h32v32H9V9z"/><path fill="#FFF" d="M19.24 35.24V21.8h-4.48v13.44h4.48z"/><defs><path d="M9 9h32v32H9z"/></defs><clipPath><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FFF" d="M26.28 35.24V28.2c0-1.92.64-3.2 1.92-3.2h.64c1.28 0 1.92 1.28 1.92 4.48v5.76h4.48V28.2c0-4.48-1.28-6.4-4.48-6.4-3.84 0-4.479 1.92-4.479 1.92V21.8H21.8v13.44h4.48zm-6.72-17.92a2.56 2.56 0 1 1-5.12 0 2.56 2.56 0 0 1 5.12 0"/></svg>
|
61
|
+
|
62
|
+
<% elsif link[:icon] == 'youtube' %>
|
63
|
+
<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="M19.88 33.32V16.68L33.32 25l-13.44 8.32z"/></svg>
|
64
|
+
|
65
|
+
<% else %>
|
66
|
+
<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>
|
67
|
+
|
68
|
+
<% end %>
|
69
|
+
</span><span class="visually-hidden">Share on </span><%= link[:text] %><% end %>
|
70
|
+
</li>
|
71
|
+
<% end %>
|
72
|
+
</ul>
|
35
73
|
</div>
|
36
74
|
<% end %>
|