metadata_presenter 0.13.1 → 0.13.6

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: 1a8dce466c95696d58b5bcacb36d9718dc7c0896be25c34f07897f3ef294dd11
4
- data.tar.gz: b32d4a787136f21eeeb72f667b40628739c1f8c48444a500cf936adb17d7decb
3
+ metadata.gz: 99966bf36bf6ab26561715bdaf04ebd5418fd384ee72c29e63a88a3d9ec66a3c
4
+ data.tar.gz: 17bb64ca45b15dc5744c668fcb8d24d8795876b1d97a6e111aae530a64a55cc1
5
5
  SHA512:
6
- metadata.gz: f7b10768d74009b16cd78a6d58d454e6c4fab8dbcb5fcf19f9af447f071910e9bb0801fb4e7816709aa8d58c5ac9ef12f23ac0fae235748cb78391a03a74a0d5
7
- data.tar.gz: 2982e42f4bec096e62bc686d29ab544feb709a5aa84c428bd6b6572bfbac32affe3e760089522a3145aed0e9b4577fd7a29828a6a11a14e976e80e98f2878b9e
6
+ metadata.gz: 104d633d1375cdae3936efeed3c02cec7b7d82f293ad4e12d0e8ebb0ea94ffa3b3aa9776542839c590700bf88a23150433a6da9c0ff5b6c27e4206caa5de3e3a
7
+ data.tar.gz: c7c192e99dad1b1564790de8bc3a813880c3da0f1dd0eb87372109248f5f82b8de897f215d20f36b63b3774cc9b6e9fabbd40d2eaba0036bd8b3397d13c4c67f
@@ -8,7 +8,9 @@ module MetadataPresenter
8
8
  def back_link
9
9
  return if @page.blank?
10
10
 
11
- @back_link ||= service.previous_page(current_page: @page)&.url
11
+ previous_page = service.previous_page(current_page: @page)&.url
12
+
13
+ @back_link ||= File.join(request.script_name, previous_page) if previous_page
12
14
  end
13
15
  helper_method :back_link
14
16
 
@@ -51,7 +51,7 @@ module MetadataPresenter
51
51
  end
52
52
 
53
53
  def checkboxes(value)
54
- value.reject(&:blank?).join("<br>").html_safe
54
+ value.join("<br>").html_safe
55
55
  end
56
56
  end
57
57
  end
@@ -63,12 +63,7 @@ module MetadataPresenter
63
63
  # @return [String] user answer for the specific component
64
64
  #
65
65
  def user_answer
66
- value = page_answers.send(component.name)
67
- if component.type == 'checkboxes'
68
- Array(value).reject(&:blank?)
69
- else
70
- value
71
- end
66
+ page_answers.send(component.name)
72
67
  end
73
68
 
74
69
  # The default error message will be look using the schema key.
@@ -5,5 +5,6 @@
5
5
  :name,
6
6
  :description,
7
7
  legend: { text: input_title },
8
- hint: { text: component.hint }
8
+ hint: { text: component.hint },
9
+ include_hidden: false
9
10
  %>
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
  <% if service.service_name.present? %>
28
28
  <div class="govuk-header__content">
29
- <a href="/" class="govuk-header__link govuk-header__link--service-name">
29
+ <a href="<%= root_path %>" class="govuk-header__link govuk-header__link--service-name">
30
30
  <%= service.service_name %>
31
31
  </a>
32
32
  <% end %>
@@ -1,33 +1,41 @@
1
- <div class="fb-main-grid-wrapper" data-block-id="<%= @page.id %>" data-block-type="page" data-block-pagetype="<%= @page.type %>">
1
+ <div class="fb-main-grid-wrapper" data-fb-pagetype="<%= @page.type %>">
2
2
  <div class="govuk-grid-row">
3
3
  <div class="govuk-grid-column-two-thirds">
4
4
  <% if @page.section_heading -%>
5
- <p class="govuk-caption-l fb-section_heading" data-block-id="<%= @page.id %>" data-block-property="section_heading">
5
+ <p class="fb-editable govuk-caption-l fb-section_heading"
6
+ data-fb-content-type="element"
7
+ data-fb-content-id="page[section_heading]">
6
8
  <%= @page.section_heading.html_safe %>
7
9
  </p>
8
10
  <%- end %>
9
11
 
10
12
  <% if @page.heading %>
11
- <h1 class="<%= @page.heading_class %>" data-block-id="<%= @page.id %>" data-block-property="heading">
13
+ <h1 class="fb-editable <%= @page.heading_class %>"
14
+ data-fb-content-id="page[heading]"
15
+ data-fb-content-type="element">
12
16
  <%= @page.heading.html_safe %>
13
17
  </h1>
14
18
  <% end %>
15
19
 
16
20
  <% if @page.lede %>
17
- <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="lede">
21
+ <div class="fb-editable"
22
+ data-fb-content-id="page[lede]"
23
+ data-fb-content-type="content">
18
24
  <%= @page.lede.html_safe %>
19
- </p>
25
+ </div>
20
26
  <%- end %>
21
27
 
22
28
  <% if @page.body %>
23
- <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="lede">
24
- <%= to_markdown(@page.body) %>
25
- </p>
29
+ <div class="fb-editable"
30
+ data-fb-content-id="page[body]"
31
+ data-fb-content-type="content">
32
+ <%= to_markdown(@page.body) %>
33
+ </div>
26
34
  <%- end %>
27
35
 
28
36
  <%= form_tag(root_path, method: :post) do %>
29
37
  <button <%= 'disabled' if editable? %> class='govuk-button govuk-button--start govuk-!-margin-top-2'>
30
- Start
38
+ Start now
31
39
  <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
32
40
  <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
33
41
  </svg>
@@ -35,9 +43,11 @@
35
43
  <% end %>
36
44
 
37
45
  <% if @page.before_you_start %>
38
- <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="before-you-start">
39
- <%= to_markdown(@page.before_you_start) %>
40
- </p>
46
+ <div class="fb-editable"
47
+ data-fb-content-id="page[before_you_start]"
48
+ data-fb-content-type="content">
49
+ <%= to_markdown(@page.before_you_start) %>
50
+ </div>
41
51
  <%- end %>
42
52
  </div>
43
53
  </div>
@@ -3,7 +3,22 @@
3
3
  "_type": "checkboxes",
4
4
  "errors": {},
5
5
  "hint": "[Hint text (optional)]",
6
- "items": [],
6
+ "items": [
7
+ {
8
+ "_id": "component_checkbox_1",
9
+ "_type": "checkbox",
10
+ "label": "Option",
11
+ "hint": "[Hint text (optional)]",
12
+ "value": "value-1"
13
+ },
14
+ {
15
+ "_id": "component_checkbox_2",
16
+ "_type": "checkbox",
17
+ "label": "Option",
18
+ "hint": "[Hint text (optional)]",
19
+ "value": "value-2"
20
+ }
21
+ ],
7
22
  "name": "component-name",
8
23
  "legend": "Question"
9
24
  }
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.13.1'
2
+ VERSION = '0.13.6'
3
3
  end
@@ -36,7 +36,6 @@
36
36
  }
37
37
  ],
38
38
  "required": [
39
- "name",
40
39
  "label"
41
40
  ],
42
41
  "transforms": {
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.13.1
4
+ version: 0.13.6
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-02-16 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails