metadata_presenter 2.17.45 → 2.18.1

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: 137fd7dcc8b75147ce2319e686a313bc0a9e5fb40c142c375adb2e720d65f0bc
4
- data.tar.gz: 60b64240fb4bec99141bfab754765d149ae53d1ee4b1fa8dc557f0e1f10d16d4
3
+ metadata.gz: 679fc7c231d025148d4739f5fd6a08c92899fa41e9b566d615eb8f1bd460b624
4
+ data.tar.gz: e0cfdd72f73765cc8d99da2fbef07e6532c69077133cab61fc0e74901986fd2c
5
5
  SHA512:
6
- metadata.gz: 247abe18e1a6686f8033dac7f206d0df1efe4f286d7416f6bfa95385ce360bd55fb0d3da359146567bf280c765b7894bd32ac3f3c673b413f7538c35a72b2f58
7
- data.tar.gz: baf4e5b9b8020f2ed454fa6dc4b434f49667b97703ddfb6b289d71cba3fc2980589b5e0bdc53750c7dc337d1dadcba29cc009b63d62874fa42951d800ef8f826
6
+ metadata.gz: fb203e02e9c6083c6234c8bc8384616b69beacffee6ee0c396f81fde0e8b6d7ca72b66f56abd3f25eb15fe3b3b3188c853b0b267b06d3d22af151e37df45924a
7
+ data.tar.gz: d1e13c6d5d0bd8f46b08722cf92b7e4dd0559a0422b3a99218340510558e2568e3b0a05f15900d96b2501b0d59aab79989391905df8e9b1c5aa28eb036ceae46
@@ -15,6 +15,12 @@ module MetadataPresenter
15
15
  end
16
16
  end
17
17
 
18
+ def save_form_progress
19
+ if defined? super
20
+ super
21
+ end
22
+ end
23
+
18
24
  def back_link
19
25
  previous_page = PreviousPage.new(
20
26
  service:,
@@ -95,6 +101,10 @@ module MetadataPresenter
95
101
  render template: 'errors/404', status: :not_found
96
102
  end
97
103
 
104
+ def internal_server_error
105
+ render template: 'errors/500', status: :internal_server_error
106
+ end
107
+
98
108
  def redirect_to_page(url)
99
109
  redirect_to File.join(request.script_name, url)
100
110
  end
@@ -1,13 +1,69 @@
1
1
  module MetadataPresenter
2
2
  class SaveAndReturnController < EngineController
3
- before_action :check_feature_flag
4
- helper_method :secret_questions
3
+ # before_action :check_feature_flag
4
+ helper_method :secret_questions, :page_slug, :confirmed_email
5
5
 
6
6
  def show
7
7
  @saved_form = SavedForm.new
8
8
  end
9
9
 
10
- def create; end
10
+ def page_slug
11
+ session['saved_form']['page_slug'] || params[:page_slug]
12
+ end
13
+
14
+ def confirmed_email
15
+ session['saved_form']['email']
16
+ # TODO: clear session data after submission is successful
17
+ end
18
+
19
+ def create
20
+ @saved_form = SavedForm.new
21
+ @saved_form.populate_param_values(saved_form_params)
22
+ @saved_form.secret_question = text_for(params['saved_form']['secret_question'])
23
+ @saved_form.populate_service_values(service)
24
+ @saved_form.populate_session_values(session)
25
+ if @saved_form.valid?
26
+ # put in session until we have confirmed email address
27
+ session[:saved_form] = @saved_form
28
+ redirect_to '/save/email_confirmation'
29
+ else
30
+ render :show, params: { page_slug: params[:page_slug], status: :unprocessable_entity }
31
+ end
32
+ end
33
+
34
+ def email_confirmation
35
+ @saved_form = session[:saved_form]
36
+ @email_confirmation = EmailConfirmation.new
37
+ end
38
+
39
+ def confirm_email
40
+ @email_confirmation = EmailConfirmation.new
41
+ @email_confirmation.assign_attributes(confirmation_params[:email_confirmation], session['saved_form']['email'])
42
+
43
+ if @email_confirmation.valid?
44
+ response = save_form_progress
45
+ if response.status != 200
46
+ internal_server_error and return
47
+ end
48
+
49
+ # send_email(response.body['id'], confirmation_params[:email_confirmation])
50
+ redirect_to '/save/progress_saved'
51
+ else
52
+ render :email_confirmation, status: :unprocessable_entity
53
+ end
54
+ end
55
+
56
+ # def return
57
+ # uuid = params[:uuid]
58
+ # response = get_saved_progress(uuid)
59
+
60
+ # session[:user_id] = response['user_id']
61
+ # session[:user_token] = response['user_token']
62
+
63
+ # Rails.logger.info('returning to form')
64
+ # Rails.logger.info('session')
65
+ # redirect_to '/check-answers'
66
+ # end
11
67
 
12
68
  def secret_questions
13
69
  [
@@ -17,6 +73,29 @@ module MetadataPresenter
17
73
  ]
18
74
  end
19
75
 
76
+ def text_for(question)
77
+ return nil if question.blank?
78
+
79
+ secret_questions.select { |s| s.id.to_s == question.to_s }.first.name
80
+ end
81
+
82
+ def saved_form_params
83
+ params.permit(
84
+ :email,
85
+ :secret_answer,
86
+ { saved_form: %i[page_slug secret_question] },
87
+ :authenticity_token,
88
+ :page_slug
89
+ )
90
+ end
91
+
92
+ def confirmation_params
93
+ params.permit(
94
+ :email_confirmation,
95
+ :authenticity_token
96
+ )
97
+ end
98
+
20
99
  private
21
100
 
22
101
  def check_feature_flag
@@ -0,0 +1,17 @@
1
+ module MetadataPresenter
2
+ class EmailConfirmation
3
+ include ActiveModel::Model
4
+
5
+ attr_accessor :email_confirmation,
6
+ :session_email
7
+
8
+ validates_with EmailConfirmationValidator
9
+
10
+ def initialize; end
11
+
12
+ def assign_attributes(email_confirmation, session_email)
13
+ @email_confirmation = email_confirmation
14
+ @session_email = session_email
15
+ end
16
+ end
17
+ end
@@ -1,11 +1,39 @@
1
1
  module MetadataPresenter
2
2
  class SavedForm
3
3
  include ActiveModel::Model
4
+ validates_with SavedProgressValidator
4
5
 
5
6
  attr_accessor :email,
6
7
  :secret_question,
7
- :secret_answer
8
+ :secret_answer,
9
+ :page_slug,
10
+ :service_slug,
11
+ :service_version,
12
+ :user_id,
13
+ :user_token,
14
+ :user_data_payload,
15
+ :attempts,
16
+ :active
8
17
 
18
+ validates :secret_question, :secret_answer, :service_slug, :page_slug, :service_version, :user_id, :user_token, presence: true, allow_blank: false
9
19
  def initialize; end
20
+
21
+ def populate_param_values(params)
22
+ self.email = params['email']
23
+ self.page_slug = params['saved_form']['page_slug']
24
+ self.secret_question = params['saved_form']['secret_question']
25
+ self.secret_answer = params['secret_answer']
26
+ end
27
+
28
+ def populate_session_values(session)
29
+ self.user_id = session[:user_id]
30
+ self.user_token = session[:user_token]
31
+ self.user_data_payload = session[:user_data]
32
+ end
33
+
34
+ def populate_service_values(service)
35
+ self.service_slug = service.service_slug
36
+ self.service_version = service.version_id
37
+ end
10
38
  end
11
39
  end
@@ -0,0 +1,7 @@
1
+ class EmailConfirmationValidator < ActiveModel::Validator
2
+ def validate(record)
3
+ if record.email_confirmation != record.session_email
4
+ record.errors.add(:email_confirmation, I18n.t('presenter.save_and_return.validation.email_not_matched'))
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ class SavedProgressValidator < ActiveModel::Validator
2
+ def validate(record)
3
+ regex = URI::MailTo::EMAIL_REGEXP
4
+ if record.email.match(regex).nil?
5
+ record.errors.add(:email, I18n.t('presenter.save_and_return.validation.email'))
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,100 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>There is a problem with MoJ Forms - MoJ Forms</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ /* CSS generated using the UseCSS browser extension: https://chrome.google.com/webstore/detail/css-used/cdopjfddjlonogibjahpnmjpoangjfff/related?hl=en */
8
+ /* Generated from a live MoJ forms 404 page */
9
+ .govuk-body-m{color:#0b0c0c;font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:16px;font-size:1rem;line-height:1.25;margin-top:0;margin-bottom:15px;}
10
+ .govuk-main-wrapper{display:block;padding-top:20px;padding-bottom:20px;}
11
+ .govuk-main-wrapper--auto-spacing:first-child{padding-top:30px;}
12
+ .govuk-template__body{margin:0;background-color:#fff;}
13
+ .govuk-width-container{max-width:960px;margin-right:15px;margin-left:15px;}
14
+ .govuk-header{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:14px;font-size:.875rem;line-height:1.1428571429;border-bottom:10px solid #fff;color:#fff;background:#0b0c0c;}
15
+ .govuk-header__container{position:relative;margin-bottom:-10px;padding-top:10px;border-bottom:10px solid #1d70b8;}
16
+ .govuk-header__container:after{content:"";display:block;clear:both;}
17
+ .govuk-header__logotype{display:inline-block;margin-right:5px;}
18
+ .govuk-header__logotype:last-child{margin-right:0;}
19
+ .govuk-header__logotype-crown{position:relative;top:-1px;margin-right:1px;fill:currentcolor;vertical-align:top;}
20
+ .govuk-header__logotype-crown-fallback-image{width:36px;height:32px;border:0;vertical-align:bottom;}
21
+ .govuk-header__link{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;}
22
+ .govuk-header__link:link,.govuk-header__link:visited{color:#fff;}
23
+ .govuk-header__link:active,.govuk-header__link:hover{color:hsla(0,0%,100%,.99);}
24
+ .govuk-header__link:hover{text-decoration:underline;text-decoration-thickness:3px;text-underline-offset:.1em;}
25
+ .govuk-header__link:focus{outline:3px solid transparent;color:#0b0c0c;background-color:#fd0;box-shadow:0 -2px #fd0,0 4px #0b0c0c;text-decoration:none;}
26
+ .govuk-header__link--homepage{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:700;display:inline-block;margin-right:10px;font-size:30px;line-height:1;}
27
+ .govuk-header__link--homepage:link,.govuk-header__link--homepage:visited{text-decoration:none;}
28
+ .govuk-header__link--homepage:active,.govuk-header__link--homepage:hover{margin-bottom:-3px;border-bottom:3px solid;}
29
+ .govuk-header__link--homepage:focus{margin-bottom:0;border-bottom:0;}
30
+ .govuk-header__service-name{display:inline-block;margin-bottom:10px;font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:700;font-size:18px;font-size:1.125rem;line-height:1.1111111111;}
31
+ .govuk-header__content,.govuk-header__logo{box-sizing:border-box;}
32
+ .govuk-header__logo{margin-bottom:10px;padding-right:50px;}
33
+ .govuk-skip-link{position:absolute!important;width:1px!important;height:1px!important;margin:0!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;white-space:nowrap!important;font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:underline;font-size:14px;font-size:.875rem;line-height:1.1428571429;display:block;padding:10px 15px;}
34
+ .govuk-skip-link:active,.govuk-skip-link:focus{position:static!important;width:auto!important;height:auto!important;margin:inherit!important;overflow:visible!important;clip:auto!important;-webkit-clip-path:none!important;clip-path:none!important;white-space:inherit!important;}
35
+ .govuk-skip-link:link,.govuk-skip-link:visited{color:#0b0c0c;}
36
+ .govuk-skip-link:hover{color:rgba(11,12,12,.99);}
37
+ .govuk-skip-link:active,.govuk-skip-link:focus{color:#0b0c0c;}
38
+ .govuk-skip-link:focus{outline:3px solid #fd0;outline-offset:0;background-color:#fd0;}
39
+ .govuk-visually-hidden{padding:0!important;border:0!important;}
40
+ .govuk-visually-hidden{position:absolute!important;width:1px!important;height:1px!important;margin:0!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;white-space:nowrap!important;}
41
+ #main-content{min-height:55vh;}
42
+ .govuk-link{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:underline;}
43
+ .govuk-link:focus{outline:3px solid transparent;background-color:#fd0;box-shadow:0 -2px #fd0,0 4px #0b0c0c;text-decoration:none;}
44
+ .govuk-link:link{color:#1d70b8;}
45
+ .govuk-link:visited{color:#4c2c92;}
46
+ .govuk-link:hover{color:#003078;}
47
+ .govuk-link:active,.govuk-link:focus{color:#0b0c0c;}
48
+ @media (min-width:40.0625em){
49
+ .govuk-body-m{font-size:19px;font-size:1.1875rem;line-height:1.3157894737;}
50
+ .govuk-body-m{margin-bottom:20px;}
51
+ .govuk-main-wrapper{padding-top:40px;padding-bottom:40px;}
52
+ .govuk-main-wrapper--auto-spacing:first-child{padding-top:50px;}
53
+ .govuk-width-container{margin-right:30px;margin-left:30px;}
54
+ .govuk-header{font-size:16px;font-size:1rem;line-height:1.25;}
55
+ .govuk-header__link--homepage{display:inline;}
56
+ .govuk-header__link--homepage:focus{box-shadow:0 0 #fd0;}
57
+ .govuk-header__service-name{font-size:24px;font-size:1.5rem;line-height:1.25;}
58
+ .govuk-header__logo{width:33.33%;padding-right:15px;float:left;vertical-align:top;}
59
+ .govuk-header__content{width:66.66%;padding-left:15px;float:left;}
60
+ .govuk-skip-link{font-size:16px;font-size:1rem;line-height:1.25;}
61
+ }
62
+ @media (min-width:1020px){
63
+ .govuk-width-container{margin-right:auto;margin-left:auto;}
64
+ }
65
+ @media (forced-colors:active){
66
+ .govuk-header__logotype{forced-color-adjust:none;color:linktext;}
67
+ }
68
+ </style>
69
+ </head>
70
+
71
+ <body class="govuk-template__body">
72
+ <header class="govuk-header" role="banner" data-module="govuk-header">
73
+ <a href="#main-content" class="govuk-skip-link" data-module="govuk-skip-link">Skip to main content</a>
74
+ <div class="govuk-header__container govuk-width-container">
75
+ <div class="govuk-header__logo">
76
+ <a href="/" class="govuk-header__link govuk-header__link--homepage">
77
+ <span class="govuk-header__logotype">
78
+ <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="30" width="36">
79
+ <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
80
+ <image src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
81
+ </svg>
82
+ <span class="govuk-header__logotype-text">
83
+ GOV.UK
84
+ </span>
85
+ </span>
86
+ </a>
87
+ </div>
88
+ </div>
89
+ </header>
90
+
91
+ <div class="govuk-width-container govuk-body-m">
92
+ <main class="govuk-main-wrapper govuk-main-wrapper--auto-spacing" id="main-content" role="main">
93
+ <!-- This file lives in public/500.html -->
94
+ <h1>Sorry, there is a problem with this form</h1>
95
+ <p>Try again later.</p>
96
+ <p>If you were in the middle of completing the form, your data has not been saved.</p>
97
+ </main>
98
+ </div>
99
+ </body>
100
+ </html>
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
  <% end %>
22
22
 
23
- <%= f.govuk_submit(disabled: editable?) %>
23
+ <%= f.govuk_submit(disabled: editable?) %> <% if ENV['SAVE_AND_RETURN'] == 'enabled' %><a href="<%= save_path(:page_slug=>request.env['PATH_INFO']) %>" class="govuk-button" data-module="govuk-button" data-component="save-button"><%= t('presenter.save_and_return.save') %></a><% end %>
24
24
  <% end %>
25
25
  </div>
26
26
  </div>
@@ -0,0 +1,22 @@
1
+ <div class="fb-main-grid-wrapper">
2
+ <div class="govuk-grid-row">
3
+ <div class="govuk-grid-column-two-thirds">
4
+ <h1 id="page-heading" class="govuk-heading-xl"><%= t('presenter.save_and_return.confirm_email.heading') %></h1>
5
+ <%= form_for @email_confirmation do |f| %>
6
+ <%= f.govuk_error_summary %>
7
+ <div class="govuk-form-group">
8
+ <%=
9
+ f.govuk_email_field :email_confirmation,
10
+ label: { text: t('presenter.save_and_return.show.email_confirmation') },
11
+ name: "email_confirmation",
12
+ spellcheck: "false",
13
+ autocomplete: "email"
14
+ %>
15
+ </div>
16
+
17
+ <p class="mojf-settings-screen__description"><%= t('presenter.save_and_return.confirm_email.description') %></p>
18
+
19
+ <%= f.govuk_submit t('presenter.save_and_return.show.continue') %><% end %> <%= link_to t('presenter.save_and_return.show.cancel'), page_slug, class: "govuk-button govuk-button--secondary" %>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="fb-main-grid-wrapper">
2
+ <div class="govuk-grid-row">
3
+ <div class="govuk-grid-column-two-thirds">
4
+ <h1 id="page-heading" class="govuk-heading-xl"><%= t('presenter.save_and_return.saved.heading') %></h1>
5
+ <p class="mojf-settings-screen__description"><%= t('presenter.save_and_return.saved.success', email: confirmed_email) %></p>
6
+ <p class="govuk-hint"><%= t('presenter.save_and_return.saved.info_1') %></p>
7
+ <br/>
8
+ <p class="govuk-hint"><%= t('presenter.save_and_return.saved.info_2') %></p>
9
+ <br/>
10
+ <p class="govuk-hint"><%= t('presenter.save_and_return.saved.info_3') %></p>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -7,6 +7,7 @@
7
7
  <%= form_for @saved_form do |f| %>
8
8
  <%= f.govuk_error_summary %>
9
9
  <div class="govuk-form-group">
10
+ <%= f.hidden_field(:page_slug, value: page_slug) %>
10
11
  <%=
11
12
  f.govuk_email_field :email,
12
13
  label: { text: t('presenter.save_and_return.show.email') },
@@ -37,7 +38,7 @@
37
38
  %>
38
39
  </div>
39
40
 
40
- <%= f.govuk_submit t('presenter.save_and_return.show.continue') %><% end %> <%= link_to t('presenter.save_and_return.show.cancel'), :back %>
41
+ <%= f.govuk_submit t('presenter.save_and_return.show.continue') %><% end %> <%= link_to t('presenter.save_and_return.show.cancel'), page_slug, class: "govuk-button govuk-button--secondary" %>
41
42
  </div>
42
43
  </div>
43
44
  </div>
@@ -48,6 +48,18 @@ en:
48
48
  secret_answer: 'The answer to your security question'
49
49
  continue: 'Continue with saving'
50
50
  cancel: 'Cancel saving and resume form'
51
+ confirm_email:
52
+ heading: 'Check your email address is correct'
53
+ description: 'Make sure this is correct before finishing'
54
+ saved:
55
+ heading: 'Your form has been saved'
56
+ success: "We have sent a one-off link to %{email} which you can use to resume this form within 28 days. After that time, your saved information will be deleted."
57
+ info_1: "If you haven't received the email after a few minutes, check your spam folder."
58
+ info_2: 'This link will only work once. If you want to save your progress again after resuming the form, you will need to repeat the save process and generate another link'
59
+ info_3: 'You are now free to close this window or navigate away from this page.'
60
+ validation:
61
+ email: 'Enter an email address in the correct format, like name@example.com'
62
+ email_not_matched: 'Does not match'
51
63
  secret_questions:
52
64
  one: "What is your mother's maiden name?"
53
65
  two: 'What is the last name of your favourite teacher?'
data/config/routes.rb CHANGED
@@ -12,6 +12,10 @@ MetadataPresenter::Engine.routes.draw do
12
12
 
13
13
  get 'save', to: 'save_and_return#show'
14
14
  post 'saved_forms', to: 'save_and_return#create'
15
+ get 'save/email_confirmation', to: 'save_and_return#email_confirmation'
16
+ post 'email_confirmations', to: 'save_and_return#confirm_email'
17
+ get 'save/progress_saved', to: 'save_and_return#save_progress'
18
+ # get 'return/:service_slug/:uuid', to: 'save_and_return#return'
15
19
 
16
20
  post '/', to: 'answers#create'
17
21
  match '*path', to: 'answers#create', via: :post
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '2.17.45'.freeze
2
+ VERSION = '2.18.1'.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.45
4
+ version: 2.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MoJ Forms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder
@@ -271,6 +271,7 @@ files:
271
271
  - app/models/metadata_presenter/conditional.rb
272
272
  - app/models/metadata_presenter/coordinates.rb
273
273
  - app/models/metadata_presenter/date_field.rb
274
+ - app/models/metadata_presenter/email_confirmation.rb
274
275
  - app/models/metadata_presenter/evaluate_conditionals.rb
275
276
  - app/models/metadata_presenter/expression.rb
276
277
  - app/models/metadata_presenter/file_uploader.rb
@@ -301,6 +302,7 @@ files:
301
302
  - app/operators/metadata_presenter/is_operator.rb
302
303
  - app/operators/metadata_presenter/operator.rb
303
304
  - app/presenters/metadata_presenter/page_answers_presenter.rb
305
+ - app/validators/email_confirmation_validator.rb
304
306
  - app/validators/metadata_presenter/accept_validator.rb
305
307
  - app/validators/metadata_presenter/autocomplete_validator.rb
306
308
  - app/validators/metadata_presenter/base_validator.rb
@@ -322,7 +324,9 @@ files:
322
324
  - app/validators/metadata_presenter/validate_schema.rb
323
325
  - app/validators/metadata_presenter/virus_scan_validator.rb
324
326
  - app/validators/metadata_presenter/word_count.rb
327
+ - app/validators/saved_progress_validator.rb
325
328
  - app/views/errors/404.html
329
+ - app/views/errors/500.html
326
330
  - app/views/layouts/metadata_presenter/application.html.erb
327
331
  - app/views/metadata_presenter/analytics/_cookie_banner_confirmation.html.erb
328
332
  - app/views/metadata_presenter/analytics/_cookie_banner_request.html.erb
@@ -360,6 +364,8 @@ files:
360
364
  - app/views/metadata_presenter/page/singlequestion.html.erb
361
365
  - app/views/metadata_presenter/page/standalone.html.erb
362
366
  - app/views/metadata_presenter/page/start.html.erb
367
+ - app/views/metadata_presenter/save_and_return/email_confirmation.html.erb
368
+ - app/views/metadata_presenter/save_and_return/save_progress.html.erb
363
369
  - app/views/metadata_presenter/save_and_return/show.html.erb
364
370
  - app/views/metadata_presenter/session/_timeout_fallback.html.erb
365
371
  - app/views/metadata_presenter/session/_timeout_warning_modal.html.erb