metadata_presenter 0.3.0 → 0.3.1

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: cff1faeeda0dc9ad30f761911443f2f61adade496ec5c1083dbbe5f30a4d98b3
4
- data.tar.gz: a52199fbdfea2f4ee641dd62d792f7bfc2ab76955c40eb8edd0109171120a22f
3
+ metadata.gz: da4d7d444ed39c7f2f0815e1c7a6034893106531275dd4de9f97f655e5b6615f
4
+ data.tar.gz: 3e952b54e9652043c6f56d601a82e6bdc414f0c76a932cd17209be26a0914933
5
5
  SHA512:
6
- metadata.gz: cd44c337711cb58997b98ff2ef941f573093d135ba79342181226ac294a5efc134072767ed505199c188d906a5a26a500d93bf937ee359309023595674af290f
7
- data.tar.gz: 19e793b3f02f3fcba3fb45822da09b6dd4c48037512af6616a8711d3d841cf90f7b549605cb822d891bc5124e39a59d5ace2549757227dd8bb9038de1bc56764
6
+ metadata.gz: e0fd8beaea7b9141a1d58b94083b1757efeaee7160df08f347a5a47d1253736c3cdc7912e17fc0da28cd4ce8c0e8ad210c594a2bd4287c39e9ce0f8477977909
7
+ data.tar.gz: 1e768d8037be04a9e6f94c20a901cd3e29a9196cdcde94addd206ce468d2cc1ceaf19991daf22f02a2e1f42415f9a355e0e9b666f905a7f947c9d0345fa12ce5
@@ -1,5 +1,23 @@
1
1
  module MetadataPresenter
2
2
  module ApplicationHelper
3
+ ## Display user answers on the view
4
+ ## When the user doesn't answered yet the component will be blank
5
+ # or with data otherwise, so doing the if in every output is not
6
+ # pratical.
7
+ #
8
+ # The below example search for 'first_name' in the user data instance
9
+ # variable as long your load_user_data in the controller sets the variable.
10
+ #
11
+ # @example
12
+ # <%= a('first_name') %>
13
+ #
14
+ def a(component_key)
15
+ if @user_data.present?
16
+ @user_data[component_key]
17
+ end
18
+ end
19
+ alias answer a
20
+
3
21
  def to_markdown(text)
4
22
  (Kramdown::Document.new(text).to_html).html_safe
5
23
  end
@@ -3,5 +3,5 @@
3
3
  label: { text: component.label },
4
4
  hint: { text: component.hint },
5
5
  name: "answers[#{component.name}]",
6
- value: @user_data ? @user_data[component.name] : nil
6
+ value: answer(component.name)
7
7
  %>
@@ -35,7 +35,7 @@
35
35
  </dt>
36
36
 
37
37
  <dd class="govuk-summary-list__value">
38
- <%= @user_data[component.name] %>
38
+ <%=a component.name %>
39
39
  </dd>
40
40
  <dd class="govuk-summary-list__actions">
41
41
  <%= link_to(
@@ -66,7 +66,7 @@
66
66
  </div>
67
67
  <% end %>
68
68
 
69
- <button data-prevent-double-click="true" class="fb-block fb-block-actions govuk-button" data-module="govuk-button" data-block-id="actions" data-block-type="actions">
69
+ <button <%= 'disabled' if editable? %> data-prevent-double-click="true" class="fb-block fb-block-actions govuk-button" data-module="govuk-button" data-block-id="actions" data-block-type="actions">
70
70
  Accept and send application
71
71
  </button>
72
72
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
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.3.0
4
+ version: 0.3.1
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-01-25 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails