-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge bridging page and terms and conditions page
- Loading branch information
Showing
15 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/controllers/registration/terms_and_conditions_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Registration | ||
class TermsAndConditionsController < BaseController | ||
def edit; end | ||
|
||
def update | ||
form.terms_and_conditions_agreed_at = user_params[:terms_and_conditions_agreed_at] | ||
|
||
if form.save | ||
if current_user.registration_complete? | ||
redirect_to user_path, notice: t(:details_updated) | ||
else | ||
redirect_to edit_registration_name_path | ||
end | ||
else | ||
render :edit, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
private | ||
|
||
# @return [Hash] | ||
def user_params | ||
params.require(:user).permit(:terms_and_conditions_agreed_at) | ||
end | ||
|
||
# @return [Registration::NameForm] | ||
def form | ||
@form ||= | ||
TermsAndConditionsForm.new( | ||
user: current_user, | ||
terms_and_conditions_agreed_at: current_user.terms_and_conditions_agreed_at, | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Registration | ||
class TermsAndConditionsForm < BaseForm | ||
attr_accessor :terms_and_conditions_agreed_at | ||
|
||
validates :terms_and_conditions_agreed_at, presence: true | ||
|
||
# @return [Boolean] | ||
def save | ||
return false unless valid? | ||
|
||
user.update!(terms_and_conditions_agreed_at: terms_and_conditions_agreed_at) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/views/registration/terms_and_conditions/edit.html.slim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
= render 'user/debug' | ||
|
||
- content_for :page_title do | ||
= html_title 'Terms and Conditions' | ||
|
||
.govuk-grid-row | ||
.govuk-grid-column-two-thirds-from-desktop | ||
= form_for form, url: registration_terms_and_conditions_path, method: :patch do |f| | ||
= f.govuk_error_summary | ||
|
||
h1.govuk-heading-l = t('register_terms_and_conditions.heading') | ||
|
||
h3 = t('register_terms_and_conditions.subheading') | ||
|
||
= f.govuk_check_boxes_fieldset :terms_and_conditions_agreed_at, | ||
legend: { class: 'govuk-visually-hidden', text: 'Terms and conditions'}, classes: 'light-grey-box' do | ||
= m('register_terms_and_conditions.legend') | ||
= f.terms_and_conditions_check_box | ||
|
||
|
||
.govuk-button-group | ||
= f.govuk_submit t('links.continue') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters