govuk_publishing_components 16.23.0 → 16.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +12 -13
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +0 -6
- data/app/views/govuk_publishing_components/components/_notice.html.erb +27 -23
- data/app/views/govuk_publishing_components/components/_radio.html.erb +2 -6
- data/app/views/govuk_publishing_components/components/docs/notice.yml +5 -2
- data/lib/govuk_publishing_components/presenters/machine_readable/creative_work_schema.rb +2 -17
- data/lib/govuk_publishing_components/presenters/schema_org.rb +0 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- metadata +2 -3
- data/lib/govuk_publishing_components/presenters/machine_readable/how_to_schema.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c3b9a98afcaf2d01914bc711fa1953844acde29a59996fb1fc7a40407690acb
|
4
|
+
data.tar.gz: 1ac2eb2ea94976dc7ecaa7d26e6e928e14d6d0797e68412b4137a9c71348a6c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5232649f3767d312ab315dc86a29671e7667e87dd2d1a0cd46a057a12839d84e64780483f6062477f6660bcc223b3d01f35dbd344c2639196e6ff796850772b3
|
7
|
+
data.tar.gz: 95d6aa96e730a7dc701cf4abdab85c7d54cd7c5d64152af0c53fb67ecb570d88713fa06e8c711ea975133c41c14e7d6e300497f6a4b1cec8c3cc50c08ea68400
|
data/README.md
CHANGED
@@ -18,6 +18,7 @@ Components should be added to this gem if they are required in more than one app
|
|
18
18
|
- [Develop a component](/docs/develop-component.md)
|
19
19
|
- [Run the component guide](/docs/run-component-guide.md)
|
20
20
|
- [Move a component from an application to the gem](/docs/moving-components-upstream-into-this-gem.md)
|
21
|
+
- [Publish this gem](/docs/publishing-to-rubygems.md)
|
21
22
|
|
22
23
|
## Architecture / structure
|
23
24
|
|
@@ -1,27 +1,26 @@
|
|
1
1
|
.gem-c-notice {
|
2
2
|
@include govuk-text-colour;
|
3
|
-
|
4
|
-
|
5
|
-
border: 2px solid $govuk-blue;
|
3
|
+
@include govuk-responsive-padding(4);
|
4
|
+
@include govuk-responsive-margin(8, "bottom");
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
}
|
6
|
+
clear: both;
|
7
|
+
border: 2px solid govuk-colour("blue");
|
10
8
|
|
11
|
-
.govuk-govspeak {
|
9
|
+
.govuk-govspeak, {
|
12
10
|
p:last-child {
|
13
11
|
margin-bottom: 0;
|
14
12
|
}
|
15
13
|
}
|
16
|
-
}
|
17
14
|
|
18
|
-
.
|
19
|
-
|
15
|
+
.govuk-body:last-child {
|
16
|
+
margin-bottom: 0;
|
17
|
+
}
|
20
18
|
}
|
21
19
|
|
22
20
|
.gem-c-notice__title {
|
23
|
-
@include bold
|
24
|
-
margin: 0
|
21
|
+
@include govuk-font(24, $weight: bold);
|
22
|
+
margin-top: 0;
|
23
|
+
@include govuk-responsive-margin(4, "bottom");
|
25
24
|
|
26
25
|
&:last-child {
|
27
26
|
margin-bottom: 0;
|
@@ -33,6 +32,6 @@
|
|
33
32
|
}
|
34
33
|
|
35
34
|
.gem-c-notice__description {
|
36
|
-
@include
|
35
|
+
@include govuk-font(19);
|
37
36
|
margin: 0;
|
38
37
|
}
|
@@ -1,28 +1,32 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%>
|
9
|
-
<section class="gem-c-notice<%= margin_bottom_class %>" aria-label="Notice" role="region">
|
10
|
-
<% if description_present %>
|
11
|
-
<h2 class="gem-c-notice__title"><%= title %></h2>
|
12
|
-
<% else %>
|
13
|
-
<span class="gem-c-notice__title"><%= title %></span>
|
14
|
-
<% end %>
|
1
|
+
<%
|
2
|
+
title ||= false
|
3
|
+
description_text ||= false
|
4
|
+
description_govspeak ||= false
|
5
|
+
description ||= yield || false
|
6
|
+
local_assigns[:margin_bottom] ||= 8
|
7
|
+
local_assigns[:margin_bottom] = 8 if local_assigns[:margin_bottom] > 9
|
15
8
|
|
16
|
-
|
17
|
-
<p class="gem-c-notice__description"><%= description_text %></p>
|
18
|
-
<% end %>
|
9
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
19
10
|
|
20
|
-
|
21
|
-
|
22
|
-
<% end %>
|
11
|
+
css_classes = %w(gem-c-notice)
|
12
|
+
css_classes << (shared_helper.get_margin_bottom)
|
23
13
|
|
24
|
-
|
25
|
-
|
14
|
+
description_present = description.present? || description_text.present? || description_govspeak.present?
|
15
|
+
%>
|
16
|
+
<% if title || description_present %>
|
17
|
+
<%= tag.section class: css_classes, aria: { label: "Notice" }, role: "region" do %>
|
18
|
+
<% if title %>
|
19
|
+
<% if description_present %>
|
20
|
+
<%= tag.h2 title, class: "gem-c-notice__title" %>
|
21
|
+
<% else %>
|
22
|
+
<%= tag.span title, class: "gem-c-notice__title" %>
|
23
|
+
<% end %>
|
26
24
|
<% end %>
|
27
|
-
|
25
|
+
|
26
|
+
<%= tag.p description_text, class: "gem-c-notice__description" if description_text %>
|
27
|
+
|
28
|
+
<%= description if description %>
|
29
|
+
|
30
|
+
<%= render 'govuk_publishing_components/components/govspeak', content: description_govspeak if description_govspeak %>
|
31
|
+
<% end %>
|
28
32
|
<% end %>
|
@@ -65,9 +65,7 @@
|
|
65
65
|
} do %>
|
66
66
|
<% items.each_with_index do |item, index| %>
|
67
67
|
<% if item === :or %>
|
68
|
-
|
69
|
-
<%= t('components.radio.or') %>
|
70
|
-
</div>
|
68
|
+
<%= tag.div t('components.radio.or'), class: "govuk-radios__divider" %>
|
71
69
|
<% else %>
|
72
70
|
<%
|
73
71
|
item_next = items[index + 1] unless index === items.size - 1
|
@@ -107,9 +105,7 @@
|
|
107
105
|
<% end %>
|
108
106
|
|
109
107
|
<% if item[:conditional] %>
|
110
|
-
|
111
|
-
<%= item[:conditional] %>
|
112
|
-
</div>
|
108
|
+
<%= tag.div item[:conditional], class:"govuk-radios__conditional govuk-radios__conditional--hidden", id: conditional_id %>
|
113
109
|
<% end %>
|
114
110
|
|
115
111
|
<% end %>
|
@@ -16,11 +16,11 @@ examples:
|
|
16
16
|
with_description:
|
17
17
|
data:
|
18
18
|
title: 'Statistics release cancelled'
|
19
|
-
description: '<p>The Oil & Gas Authority launched a new website on 3 October 2016 to reflect its new status as a government company.</p><p>This formalises the transfer of the Secretary of State’s regulatory powers in respect of oil and gas to the OGA, and grants it new powers. This website will no longer be updated. Visitors should refer to <a rel="external" href="https://www.ogauthority.co.uk/news-publications/announcements/2015/establishment-of-the-oil-and-gas-authority-1/">www.ogauthority.co.uk</a></p>'
|
19
|
+
description: '<p class="govuk-body">The Oil & Gas Authority launched a new website on 3 October 2016 to reflect its new status as a government company.</p><p class="govuk-body">This formalises the transfer of the Secretary of State’s regulatory powers in respect of oil and gas to the OGA, and grants it new powers. This website will no longer be updated. Visitors should refer to <a class="govuk-link" rel="external" href="https://www.ogauthority.co.uk/news-publications/announcements/2015/establishment-of-the-oil-and-gas-authority-1/">www.ogauthority.co.uk</a></p>'
|
20
20
|
with_description_from_a_block:
|
21
21
|
data:
|
22
22
|
title: 'Statistics release update'
|
23
|
-
block: '<p>The Oil & Gas Authority launched a new website on 3 October 2016 to reflect its new status as a government company.</p><p>This formalises the transfer of the Secretary of State’s regulatory powers in respect of oil and gas to the OGA, and grants it new powers. This website will no longer be updated. Visitors should refer to <a rel="external" href="https://www.ogauthority.co.uk/news-publications/announcements/2015/establishment-of-the-oil-and-gas-authority-1/">www.ogauthority.co.uk</a></p>'
|
23
|
+
block: '<p class="govuk-body">The Oil & Gas Authority launched a new website on 3 October 2016 to reflect its new status as a government company.</p><p class="govuk-body">This formalises the transfer of the Secretary of State’s regulatory powers in respect of oil and gas to the OGA, and grants it new powers. This website will no longer be updated. Visitors should refer to <a class="govuk-link" rel="external" href="https://www.ogauthority.co.uk/news-publications/announcements/2015/establishment-of-the-oil-and-gas-authority-1/">www.ogauthority.co.uk</a></p>'
|
24
24
|
with_description_text:
|
25
25
|
data:
|
26
26
|
title: 'Statistics release cancelled'
|
@@ -33,3 +33,6 @@ examples:
|
|
33
33
|
description: In some circumstances it may be necessary to include simple markup in the title, such as a link. Note that this will be wrapped in a H2 tag if there is no description included, so be sure that any markup inserted is valid inside that tag (e.g. another heading tag inside a H2 would be invalid).
|
34
34
|
data:
|
35
35
|
title: 'Advisory Committee on Novel Foods and Processes has a <a href="http://www.food.gov.uk/acnfp">separate website</a>'
|
36
|
+
without_title:
|
37
|
+
data:
|
38
|
+
description_govspeak: '<p>Scheduled to publish at 8am on 25 April 2019<br/><a href="change-date">Change date</a><br/><a href="stop-scheduled-publishing">Stop scheduled publishing</a></p>'
|
@@ -60,28 +60,13 @@ module GovukPublishingComponents
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def is_part_of
|
63
|
-
return {} unless
|
63
|
+
return {} unless document_collections.any?
|
64
64
|
|
65
65
|
{
|
66
|
-
"isPartOf" => document_collections
|
66
|
+
"isPartOf" => document_collections
|
67
67
|
}
|
68
68
|
end
|
69
69
|
|
70
|
-
def step_by_step_schemas
|
71
|
-
# We could include `related_to_step_navs` eventually too, but initially
|
72
|
-
# link to those that we render in the "step_by_step_nav_related" component
|
73
|
-
@step_by_step_schemas ||= fetch_step_by_step_schemas
|
74
|
-
end
|
75
|
-
|
76
|
-
def fetch_step_by_step_schemas
|
77
|
-
page.content_item.dig("links", "part_of_step_navs").to_a.map do |step_by_step|
|
78
|
-
step_by_step_page = linked_page(step_by_step)
|
79
|
-
structured_data = HowToSchema.new(step_by_step_page.canonical_url).structured_data
|
80
|
-
|
81
|
-
structured_data.merge(image_schema)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
70
|
def linked_page(step_by_step)
|
86
71
|
Page.new(
|
87
72
|
content_item: step_by_step,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'govuk_publishing_components/presenters/machine_readable/page'
|
2
2
|
require 'govuk_publishing_components/presenters/machine_readable/article_schema'
|
3
3
|
require 'govuk_publishing_components/presenters/machine_readable/creative_work_schema'
|
4
|
-
require 'govuk_publishing_components/presenters/machine_readable/how_to_schema'
|
5
4
|
require 'govuk_publishing_components/presenters/machine_readable/has_part_schema'
|
6
5
|
require 'govuk_publishing_components/presenters/machine_readable/is_part_of_schema'
|
7
6
|
require 'govuk_publishing_components/presenters/machine_readable/news_article_schema'
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"/"
|
50
50
|
],
|
51
51
|
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#0c518b4fa79b9a95b544410858486ed9e6403c84",
|
52
|
-
"_shasum": "
|
52
|
+
"_shasum": "fbda18fd64d098e9fc1ace4c885f89bfa2f4adb6",
|
53
53
|
"_shrinkwrap": null,
|
54
54
|
"_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
55
55
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
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: 16.
|
4
|
+
version: 16.24.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: 2019-05-
|
11
|
+
date: 2019-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|
@@ -662,7 +662,6 @@ files:
|
|
662
662
|
- lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb
|
663
663
|
- lib/govuk_publishing_components/presenters/machine_readable/creative_work_schema.rb
|
664
664
|
- lib/govuk_publishing_components/presenters/machine_readable/has_part_schema.rb
|
665
|
-
- lib/govuk_publishing_components/presenters/machine_readable/how_to_schema.rb
|
666
665
|
- lib/govuk_publishing_components/presenters/machine_readable/is_part_of_schema.rb
|
667
666
|
- lib/govuk_publishing_components/presenters/machine_readable/news_article_schema.rb
|
668
667
|
- lib/govuk_publishing_components/presenters/machine_readable/organisation_schema.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module GovukPublishingComponents
|
2
|
-
module Presenters
|
3
|
-
class HowToSchema
|
4
|
-
attr_reader :how_to_url
|
5
|
-
|
6
|
-
def initialize(how_to_url)
|
7
|
-
@how_to_url = how_to_url
|
8
|
-
end
|
9
|
-
|
10
|
-
def structured_data
|
11
|
-
# http://schema.org/HowTo - minimal
|
12
|
-
{
|
13
|
-
"@context" => "http://schema.org",
|
14
|
-
"@type" => "HowTo",
|
15
|
-
"sameAs" => how_to_url
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|