govuk_publishing_components 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d096d826f4036a0b4d935adcb65e7046e30c036
4
- data.tar.gz: 73166cb75dbfdda9d960f790c6f4f0833ffdc800
3
+ metadata.gz: 977c19c9c3c98f7113ee56e38465aa8563cb3869
4
+ data.tar.gz: c355c901404936ef826f59dcaa2f4077427e4487
5
5
  SHA512:
6
- metadata.gz: 0f40af4038b72fb80da00abb67fc9fb944495df6006a5b4609e650819717a291f30c8cb17908d17298fbdc0740c891e1d36a9fc9f13438520553040472e412ca
7
- data.tar.gz: 35d8bb1bc8d0812eb6bfe580c0edf05c015bf40eb980d64d015d0f99fbe5a161bb073922b72261f5c202f7236dc51bca8711419d4fdda2bc5e262dc8e0659843
6
+ metadata.gz: 31845d620a5314bb240ebf110653c8acbdb0e8ab4e97f00d8254fd52af8f55d7dc579cb4dec3f51c80ddfef7db1c2e79aca839733f3aaad4c8cfccfd382d7ee6
7
+ data.tar.gz: ea7d156f8ed7899d5a11bbbd745382a8721996ec5ed3c9fb08419e808f8e4a6b953956e44526fba55117ab9a66d3d3b358258538ca2bd2a6bbaf7b3a46f39e93
@@ -14,7 +14,7 @@ module GovukPublishingComponents
14
14
  def build(component)
15
15
  examples = component[:examples].map { |id, example|
16
16
  example = example || {}
17
- ComponentExample.new(id.to_s, example["data"], example["context"])
17
+ ComponentExample.new(id.to_s, example["data"], example["context"], example["description"])
18
18
  }
19
19
 
20
20
  ComponentDoc.new(component[:id],
@@ -2,12 +2,14 @@ module GovukPublishingComponents
2
2
  class ComponentExample
3
3
  attr_reader :id,
4
4
  :data,
5
- :context
5
+ :context,
6
+ :description
6
7
 
7
- def initialize(id, data, context)
8
+ def initialize(id, data, context, description)
8
9
  @id = id
9
10
  @data = data || {}
10
11
  @context = context || {}
12
+ @description = description || false
11
13
  end
12
14
 
13
15
  def name
@@ -48,5 +50,15 @@ module GovukPublishingComponents
48
50
  def right_to_left?
49
51
  !!context['right_to_left']
50
52
  end
53
+
54
+ def html_description
55
+ govspeak_to_html(description) if description.present?
56
+ end
57
+
58
+ private
59
+
60
+ def govspeak_to_html(govspeak)
61
+ Govspeak::Document.new(govspeak).to_html
62
+ end
51
63
  end
52
64
  end
@@ -3,6 +3,7 @@
3
3
 
4
4
  <div class="component-show">
5
5
  <div class="component-doc">
6
+ <%= render "govuk_component/govspeak", content: @component_example.html_description %>
6
7
  <h2 class="component-doc-h2">How to call this example</h2>
7
8
  <%= render partial: "govuk_publishing_components/component_guide/component_doc/call", locals: { component_doc: @component_doc, example: @component_example } %>
8
9
 
@@ -44,6 +44,7 @@
44
44
  <a href="<%= component_example_path(@component_doc.id, example.id) %>"><%= example.name %></a>
45
45
  <small>(<a href="<%= component_preview_path(@component_doc.id, example.id) %>">preview</a>)</small>
46
46
  </h3>
47
+ <%= render "govuk_component/govspeak", content: example.html_description %>
47
48
  <%= render "govuk_publishing_components/component_guide/component_doc/call", component_doc: @component_doc, example: example %>
48
49
  <%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, example: example %>
49
50
  </div>
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  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: 1.2.0
4
+ version: 1.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: 2017-09-01 00:00:00.000000000 Z
11
+ date: 2017-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails