metadata_presenter 2.17.28 → 2.17.30

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: 9c7a515533afa7cb555ef8b2456b6023e61eba63e7caa68b26f3e66b9a714dc9
4
- data.tar.gz: 47a5ce82180f3cb6fdc5d12c857e14b818ce21c9e4a13e5e264153b2ddc07a4d
3
+ metadata.gz: 378303acb1d79cfa54b47568adc4a71e7ebf962afeb93f15e843fd9185f94314
4
+ data.tar.gz: df2d1f7bef49a5f2555dac0092394498a2ed6de7e7f793978eb27a9d735c6a5d
5
5
  SHA512:
6
- metadata.gz: 6553f67becb02a29e169c40e8ee0540c7ed3e3e8864f810098bcc9fb7edee0087b1afce8feb486af395c9c0b9071f387b4589eada99af44bba3e33cb362c3df6
7
- data.tar.gz: ad7eb71be34c175cf7439af079f559546c14f5238067076a75f996d3fc7fd0fa0523c36b678391914961abc31c58d5c109f6ca449aab9202431599249b104bfd
6
+ metadata.gz: 0bb5db0c1fd70e1a9b3a463e8338ec73f5dbe389d872569e23f6862271b9e5a9064586f02ce1191cc534f5926b9bd887eb02f32230b54789178e47590d71cd93
7
+ data.tar.gz: 63bb8ce4122db2bb72366336a8ad838abf55733e50782d8b9a40cf3f7ee8388e66c6a83cff40895e22cb866c345a7c43572e28b335e472413e35cce5a9734765
data/README.md CHANGED
@@ -52,6 +52,8 @@ that you need to write the following methods in your controller:
52
52
  5. assign_autocomplete_items
53
53
  6. reference_number_enabled?
54
54
  7. show_reference_number
55
+ 8. payment_link_enabled?
56
+ 9. payment_link_url
55
57
 
56
58
  The user answers can be accessed via `params[:answers]`.
57
59
 
@@ -89,6 +91,10 @@ The `autocomplete_items` takes the components on a page and retrieves any items
89
91
 
90
92
  `show_reference_number` method will present the placeholder reference number if viewing in the Editor/Preview or will present a generated reference number if in the Runner.
91
93
 
94
+ `payment_link_enabled?` method checks whether payment link is enabled in the Runner or Editor app. For the Runner app payment link is enabled when the `ENV['PAYMENT_LINK']` variable is present. In the Editor, payment link enabled is checked by checking the `ServiceConfiguration` table.
95
+
96
+ `payment_link_url` method will present the payment link url. For the Runner this is the value of the `ENV['PAYMENT_LINK']` variable. In the Editor the value comes from the `ServiceConfiguration` table.
97
+
92
98
  ## Generate documentation
93
99
 
94
100
  Run `rake doc` and open the doc/index.html
@@ -70,6 +70,14 @@ module MetadataPresenter
70
70
  ENV['MAINTENANCE_MODE'].present? && ENV['MAINTENANCE_MODE'] == '1'
71
71
  end
72
72
 
73
+ def external_or_relative_link(link)
74
+ uri = URI.parse(link)
75
+ return link if uri.scheme.present? && uri.host.present?
76
+
77
+ link.starts_with?('/') ? link : link.prepend('/')
78
+ end
79
+ helper_method :external_or_relative_link
80
+
73
81
  private
74
82
 
75
83
  def not_found
@@ -2,7 +2,7 @@
2
2
  <ul class="govuk-footer__inline-list">
3
3
  <% service.meta.items.each do |item| %>
4
4
  <li class="govuk-footer__inline-list-item">
5
- <a class="govuk-footer__link" href=<%= File.join(request.script_name, item.href) %>><%= item.text %></a>
5
+ <a class="govuk-footer__link" href=<%= external_or_relative_link(item.href) %>><%= item.text %></a>
6
6
  </li>
7
7
  <% end %>
8
8
  </ul>
@@ -48,5 +48,9 @@
48
48
  classes: nil,
49
49
  input_components: @page.supported_input_components,
50
50
  content_components: @page.supported_content_components
51
- } %>
51
+ } %>
52
+
53
+ <% if payment_link_enabled? %>
54
+ <a href="<%= payment_link_url %>" class="govuk-button" data-module="govuk-button" data-component="pay-button"><%= t('presenter.confirmation.continue_to_pay_button') %></a>
55
+ <% end %>
52
56
  </div>
@@ -22,6 +22,7 @@ en:
22
22
  confirmation:
23
23
  reference_number: 'Your reference number is:'
24
24
  payment_enabled: You still need to pay
25
+ continue_to_pay_button: Continue to pay
25
26
  footer:
26
27
  cookies:
27
28
  heading: "Cookies"
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '2.17.28'.freeze
2
+ VERSION = '2.17.30'.freeze
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: 2.17.28
4
+ version: 2.17.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - MoJ Forms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-14 00:00:00.000000000 Z
11
+ date: 2022-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder