metadata_presenter 0.25.0 → 0.27.2

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
  SHA256:
3
- metadata.gz: a35099977b4c88777f6fef3c8102abcea16dfa668920b05dc2d3de208f7ddfbe
4
- data.tar.gz: e3251c67520b40aa6735adde064679adf4261dfa8bcb5310f17ef79e70caf173
3
+ metadata.gz: 703510699a0cde194daacc8401f1eb0d47205f44b1871bd1c572738ba63e5a47
4
+ data.tar.gz: 4a2c95289d96323e0de542644fc4dbf1c639076c492fd1a71710e43f6597f991
5
5
  SHA512:
6
- metadata.gz: 44c3c7661eec4c14f8071565e0919c93105a5489857bd506fda5b0b6c631a7d76d95598d65f11cedba70fd8386a910be52f5ef06e38f1cb15a79f1ea3b7421f3
7
- data.tar.gz: 4fb6607dd2626128cf87d1fa1296166635de4d235c5bf30cc3ed0089e9ff8b7b215d1e095a6ce6047b794163ccd287f0ed74184ccf0a8a656d404c2cf4a00668
6
+ metadata.gz: 9ec09f76ec8f500c5ef791beb3d56c71f68b8b313c7cccdf75c6fa85c4615648ed3bc60cce9fa9911a28185efc0d1d78b229458d4a6396ab87e034cef117cbaa
7
+ data.tar.gz: 110f85a1a60d26168ae1bca025dea41e3bceb9aba509f354187fdd41a3a2ece3eea147dbaf1c58435ded4551144c035df85c2b75c4c89905d3c3916c46aa6175
@@ -6,15 +6,14 @@ module MetadataPresenter
6
6
  end
7
7
  end
8
8
 
9
- # Renders markdown given a text.
9
+ # Renders html given markdown.
10
10
  #
11
11
  # @example
12
- # <%=m '# Some markdown' %>
12
+ # <%=to_html '# Some markdown' %>
13
13
  #
14
- def m(text)
14
+ def to_html(text)
15
15
  Kramdown::Document.new(text).to_html.html_safe
16
16
  end
17
- alias_method :to_markdown, :m
18
17
 
19
18
  def default_text(property)
20
19
  MetadataPresenter::DefaultText[property]
@@ -1,4 +1,8 @@
1
1
  class MetadataPresenter::Item < MetadataPresenter::Metadata
2
+ def id
3
+ label
4
+ end
5
+
2
6
  def name
3
7
  label
4
8
  end
@@ -3,6 +3,6 @@
3
3
  data-fb-content-id="page[body]"
4
4
  data-fb-content-type="content"
5
5
  data-fb-default-text="<%= default_text('body') %>">
6
- <%= to_markdown(@page.body) %>
6
+ <%= to_html(@page.body) %>
7
7
  </div>
8
8
  <%- end %>
@@ -1,7 +1,5 @@
1
- <% if @page.heading %>
2
- <h1 class="fb-editable govuk-heading-xl"
3
- data-fb-content-id="page[heading]"
4
- data-fb-content-type="element">
5
- <%= @page.heading %>
6
- </h1>
7
- <%- end %>
1
+ <h1 class="fb-editable govuk-heading-xl"
2
+ data-fb-content-id="page[heading]"
3
+ data-fb-content-type="element">
4
+ <%= @page.heading %>
5
+ </h1>
@@ -18,23 +18,3 @@
18
18
  %>
19
19
  </div>
20
20
  <% end %>
21
-
22
- <% if editable? %>
23
- <ul class="component-activated-menu govuk-navigation editor-button govuk-button fb-govuk-button">
24
- <% if input_components.present? %>
25
- <ul>
26
- <% input_components.each do |component| %>
27
- <li><a href="#add-input-component" data-component-type="<%= component %>"></a>+ Add <%= component %> component</li>
28
- <% end %>
29
- </ul>
30
- <% end %>
31
-
32
- <% if content_components.present? %>
33
- <ul>
34
- <% content_components.each do |component| %>
35
- <li><a href="#add-content-component" data-component-type="<%= component %>">+ Add <%= component %> component</a></li>
36
- <% end %>
37
- </ul>
38
- <% end %>
39
- </ul>
40
- <% end %>
@@ -1 +1 @@
1
- <%= to_markdown(component.html) %>
1
+ <%= to_html(component.content) %>
@@ -3,13 +3,11 @@
3
3
 
4
4
  <%= render partial: 'metadata_presenter/attribute/section_heading' %>
5
5
 
6
- <% if @page.heading.present? %>
7
- <h1 class="fb-editable govuk-heading-xl"
8
- data-fb-content-type="element"
9
- data-fb-content-id="page[heading]">
10
- <%= @page.heading %>
11
- </h1>
12
- <% end %>
6
+ <h1 class="fb-editable govuk-heading-xl"
7
+ data-fb-content-type="element"
8
+ data-fb-content-id="page[heading]">
9
+ <%= @page.heading %>
10
+ </h1>
13
11
 
14
12
  <%= form_for @page, url: reserved_submissions_path do |f| %>
15
13
 
@@ -4,16 +4,13 @@
4
4
 
5
5
  <%= render 'metadata_presenter/attribute/section_heading' %>
6
6
 
7
- <% if @page.heading %>
8
- <h1 class="fb-editable govuk-heading-xl"
9
- data-fb-content-id="page[heading]"
10
- data-fb-content-type="element">
11
- <%= @page.heading %>
12
- </h1>
13
- <% end %>
14
-
7
+ <h1 class="fb-editable govuk-heading-xl"
8
+ data-fb-content-id="page[heading]"
9
+ data-fb-content-type="element">
10
+ <%= @page.heading %>
11
+ </h1>
12
+
15
13
  <%= render 'metadata_presenter/attribute/lede' %>
16
-
17
14
  <%= render 'metadata_presenter/attribute/body' %>
18
15
 
19
16
  <%= form_for @page_answers, as: :answers, url: @page.url, method: :post do |f| %>
@@ -3,7 +3,7 @@
3
3
  <div class="govuk-grid-column-two-thirds">
4
4
  <% if @page.body %>
5
5
  <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="body">
6
- <%= to_markdown(@page.body) %>
6
+ <%= to_html(@page.body) %>
7
7
  </p>
8
8
  <%- end %>
9
9
  <%= form_tag(reserved_answers_path, method: :post) do %>
@@ -20,7 +20,7 @@
20
20
  <div class="fb-editable"
21
21
  data-fb-content-id="page[before_you_start]"
22
22
  data-fb-content-type="content">
23
- <%= to_markdown(@page.before_you_start) %>
23
+ <%= to_html(@page.before_you_start) %>
24
24
  </div>
25
25
  <%- end %>
26
26
  </div>
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "_id": "component.content",
3
3
  "_type": "content",
4
- "html": "[Optional content]"
4
+ "content": "[Optional content]"
5
5
  }
@@ -2,6 +2,8 @@
2
2
  "section_heading": "[Optional section heading]",
3
3
  "lede": "[Optional lede paragraph]",
4
4
  "body": "[Optional content]",
5
- "html": "[Optional content]",
6
- "hint": "[Optional hint text]"
5
+ "content": "[Optional content]",
6
+ "hint": "[Optional hint text]",
7
+ "option": "[Required option text]",
8
+ "option_hint": "[Optional hint text]"
7
9
  }
@@ -330,7 +330,7 @@
330
330
  {
331
331
  "_id": "how-many-lights_content_1",
332
332
  "_type": "content",
333
- "html": "What lights?"
333
+ "content": "What lights?"
334
334
  }
335
335
  ],
336
336
  "url": "how-many-lights"
@@ -348,7 +348,7 @@
348
348
  {
349
349
  "_id": "check-answers_content_1",
350
350
  "_type": "content",
351
- "html": "Check yourself before you wreck yourself."
351
+ "content": "Check yourself before you wreck yourself."
352
352
  }
353
353
  ],
354
354
  "extra_components": []
@@ -365,7 +365,7 @@
365
365
  {
366
366
  "_id": "confirmation_content_1",
367
367
  "_type": "content",
368
- "html": "Some day I will be the most powerful Jedi ever!"
368
+ "content": "Some day I will be the most powerful Jedi ever!"
369
369
  }
370
370
  ]
371
371
  }
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.25.0'.freeze
2
+ VERSION = '0.27.2'.freeze
3
3
  end
@@ -11,7 +11,7 @@
11
11
  "_type": {
12
12
  "const": "content"
13
13
  },
14
- "html": {
14
+ "content": {
15
15
  "title": "Content",
16
16
  "description": "Content to display - use [markdown](https://www.gov.uk/guidance/how-to-publish-on-gov-uk/markdown) to format text or add hyperlinks",
17
17
  "type": "string",
@@ -25,6 +25,6 @@
25
25
  }
26
26
  ],
27
27
  "required": [
28
- "html"
28
+ "content"
29
29
  ]
30
30
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metadata_presenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.27.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MoJ Online
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-31 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder