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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13bcbcd43bdcda0ae27e167ccddbb2e460dc6533f0a2c3e29a6729862ad5a9bb
4
- data.tar.gz: e0a1273c2b30f23724bb009fd212df6fe558655f6f21791d292ec02fe2214ff2
3
+ metadata.gz: c8684d7e01c2e01dfbb03bf69bb6aaeeadc8137f0eaa4691de731bc90c101c25
4
+ data.tar.gz: 8e7ddb8c6c6eeb1b2ad98b2c9c1601c1c5af8f3b35a33e62b7c8eb642b02f8de
5
5
  SHA512:
6
- metadata.gz: 4d4f8c2b467bcff8b0fd6cf94f63743ccfc93216bec8d8362f086ea31b2ad8ed17e7ca969b4c93a5cd8fe4e25cea87d2508d7713feeb66803a1a5356fc068c27
7
- data.tar.gz: 7e1888f1b3a3db750b356eb1560f952421f9a1eba47c4c79c8e853d1a9a6fe423e411b142e56091a1b0c17823570977019e5ba5d2c625fe75f4331f459567ad6
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
- <% if example.has_block? %>
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>
@@ -1,7 +1,15 @@
1
- <% if example.has_block? %>
2
- <%= render component_doc.partial_path, example.html_safe_data do %>
3
- <%= example.block.html_safe %>
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
- <%= render component_doc.partial_path, example.html_safe_data %>
14
+ <%= component %>
7
15
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <%
2
2
  href ||= '#main-content'
3
+ text ||= t('components.skip_link.text')
3
4
  %>
4
- <%= link_to("Skip to main content", href, class: "gem-c-skip-link govuk-skip-link") %>
5
+ <%= link_to(text, href, class: "gem-c-skip-link govuk-skip-link") %>
@@ -12,4 +12,13 @@ accessibility_criteria: |
12
12
  examples:
13
13
  default:
14
14
  data:
15
- href: '#content'
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'
@@ -49,6 +49,8 @@ en:
49
49
  policies: "Policies"
50
50
  statistical_data_sets: "Statistical data sets"
51
51
  topical_events: "Topical events"
52
+ skip_link:
53
+ text: "Skip to main content"
52
54
  step_by_step_nav:
53
55
  show: "Show"
54
56
  hide: "Hide"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '15.2.0'.freeze
2
+ VERSION = '15.3.0'.freeze
3
3
  end
@@ -49,7 +49,7 @@
49
49
  "/"
50
50
  ],
51
51
  "_resolved": "git://github.com/alphagov/accessible-autocomplete.git#0c518b4fa79b9a95b544410858486ed9e6403c84",
52
- "_shasum": "13aa3d1cdc2e88f8d67b6974cc5f76c06e6aed45",
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.2.0
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-14 00:00:00.000000000 Z
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.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.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.1
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.1
264
+ version: 3.5.0
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: yard
267
267
  requirement: !ruby/object:Gem::Requirement