govuk_publishing_components 15.2.0 → 15.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/govuk_publishing_components/component_doc.rb +4 -1
- data/app/models/govuk_publishing_components/component_example.rb +7 -1
- data/app/views/govuk_publishing_components/component_guide/component_doc/_call.html.erb +18 -10
- data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb +12 -4
- data/app/views/govuk_publishing_components/components/_skip_link.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/docs/skip_link.yml +10 -1
- data/config/locales/en.yml +2 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8684d7e01c2e01dfbb03bf69bb6aaeeadc8137f0eaa4691de731bc90c101c25
|
4
|
+
data.tar.gz: 8e7ddb8c6c6eeb1b2ad98b2c9c1601c1c5af8f3b35a33e62b7c8eb642b02f8de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2398ddae0a45b6770c797348043821fe27201eeb37a034c626b2006f45b9daaa1b6f07cb0d88ecd1d28e7e767e90caf14e03c1e41d1e691292983ff9149a91b2
|
7
|
+
data.tar.gz: aa30213e3ce4771e7ec04d69835a653a6324d5e1e860c66ce74c13637b6e0eccfc851404524f89ee9dd3bd5bf1c1375c3240acae618a900b11055afbfd1cd1d6
|
@@ -6,7 +6,8 @@ module GovukPublishingComponents
|
|
6
6
|
:body,
|
7
7
|
:component,
|
8
8
|
:accessibility_excluded_rules,
|
9
|
-
:source
|
9
|
+
:source,
|
10
|
+
:embed
|
10
11
|
|
11
12
|
def initialize(component)
|
12
13
|
@component = component
|
@@ -16,6 +17,7 @@ module GovukPublishingComponents
|
|
16
17
|
@body = component[:body]
|
17
18
|
@accessibility_excluded_rules = component[:accessibility_excluded_rules]
|
18
19
|
@source = component[:source]
|
20
|
+
@embed = component[:embed]
|
19
21
|
end
|
20
22
|
|
21
23
|
def accessibility_criteria
|
@@ -74,6 +76,7 @@ module GovukPublishingComponents
|
|
74
76
|
def examples
|
75
77
|
@examples ||= component[:examples].map do |id, example_data|
|
76
78
|
example_data = example_data || {}
|
79
|
+
example_data["embed"] ||= embed
|
77
80
|
ComponentExample.new(id.to_s, example_data)
|
78
81
|
end
|
79
82
|
end
|
@@ -6,7 +6,8 @@ module GovukPublishingComponents
|
|
6
6
|
:data,
|
7
7
|
:context,
|
8
8
|
:description,
|
9
|
-
:block
|
9
|
+
:block,
|
10
|
+
:embed
|
10
11
|
|
11
12
|
def initialize(id, example)
|
12
13
|
@id = id
|
@@ -14,6 +15,7 @@ module GovukPublishingComponents
|
|
14
15
|
@context = example["context"] || {}
|
15
16
|
@description = example["description"] || false
|
16
17
|
@block = @data.delete(:block) || false
|
18
|
+
@embed = example["embed"]
|
17
19
|
end
|
18
20
|
|
19
21
|
def name
|
@@ -73,6 +75,10 @@ module GovukPublishingComponents
|
|
73
75
|
!!block
|
74
76
|
end
|
75
77
|
|
78
|
+
def has_embed?
|
79
|
+
!!embed
|
80
|
+
end
|
81
|
+
|
76
82
|
private
|
77
83
|
|
78
84
|
def govspeak_to_html(govspeak)
|
@@ -1,12 +1,20 @@
|
|
1
|
+
<%
|
2
|
+
component_code =
|
3
|
+
if example.has_block?
|
4
|
+
"<%= render \"#{@component_doc.partial_path}\", #{example.pretty_data} do %\>\n" +
|
5
|
+
" #{example.block.html_safe}" +
|
6
|
+
"<% end %\>"
|
7
|
+
else
|
8
|
+
"<%= render \"#{@component_doc.partial_path}\", #{example.pretty_data} %\>"
|
9
|
+
end
|
10
|
+
|
11
|
+
code =
|
12
|
+
if example.has_embed?
|
13
|
+
example.embed.sub("<%= component %\>", component_code)
|
14
|
+
else
|
15
|
+
component_code
|
16
|
+
end
|
17
|
+
%>
|
1
18
|
<div class="component-call component-highlight" contenteditable>
|
2
|
-
|
3
|
-
<%
|
4
|
-
code = "<%= render \"#{@component_doc.partial_path}\", #{example.pretty_data} do %\>\n"
|
5
|
-
code += " #{example.block.html_safe}"
|
6
|
-
code += "<% end %\>"
|
7
|
-
-%>
|
8
|
-
<pre><code><%= example.highlight_code(code) %></code></pre>
|
9
|
-
<% else %>
|
10
|
-
<pre><code><%= example.highlight_code("\<%= render \"#{@component_doc.partial_path}\", #{example.pretty_data} %\>") %></code></pre>
|
11
|
-
<% end %>
|
19
|
+
<pre><code><%= example.highlight_code(code) %></code></pre>
|
12
20
|
</div>
|
data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
<%= example.
|
1
|
+
<% component = capture do %>
|
2
|
+
<% if example.has_block? %>
|
3
|
+
<%= render component_doc.partial_path, example.html_safe_data do %>
|
4
|
+
<%= example.block.html_safe %>
|
5
|
+
<% end %>
|
6
|
+
<% else %>
|
7
|
+
<%= render component_doc.partial_path, example.html_safe_data %>
|
4
8
|
<% end %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% if example.has_embed? %>
|
12
|
+
<%= ERB.new(example.embed).result(binding).html_safe %>
|
5
13
|
<% else %>
|
6
|
-
<%=
|
14
|
+
<%= component %>
|
7
15
|
<% end %>
|
@@ -12,4 +12,13 @@ accessibility_criteria: |
|
|
12
12
|
examples:
|
13
13
|
default:
|
14
14
|
data:
|
15
|
-
|
15
|
+
with_different_text:
|
16
|
+
data:
|
17
|
+
text: 'Skip to results'
|
18
|
+
with_different_href:
|
19
|
+
data:
|
20
|
+
href: '#somewhere-on-the-page'
|
21
|
+
custom_title_and_href:
|
22
|
+
data:
|
23
|
+
text: 'Skip to my content'
|
24
|
+
href: '#my-content'
|
data/config/locales/en.yml
CHANGED
@@ -49,7 +49,7 @@
|
|
49
49
|
"/"
|
50
50
|
],
|
51
51
|
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#0c518b4fa79b9a95b544410858486ed9e6403c84",
|
52
|
-
"_shasum": "
|
52
|
+
"_shasum": "2a23fb1556e095fb6cdf1a602bf8a237de5122db",
|
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: 15.
|
4
|
+
version: 15.3.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-02-
|
11
|
+
date: 2019-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govspeak
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '3.
|
159
|
+
version: '3.11'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '3.
|
166
|
+
version: '3.11'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: govuk_schemas
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -254,14 +254,14 @@ dependencies:
|
|
254
254
|
requirements:
|
255
255
|
- - "~>"
|
256
256
|
- !ruby/object:Gem::Version
|
257
|
-
version: 3.0
|
257
|
+
version: 3.5.0
|
258
258
|
type: :development
|
259
259
|
prerelease: false
|
260
260
|
version_requirements: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
|
-
version: 3.0
|
264
|
+
version: 3.5.0
|
265
265
|
- !ruby/object:Gem::Dependency
|
266
266
|
name: yard
|
267
267
|
requirement: !ruby/object:Gem::Requirement
|