Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externalise go back and create overrides to concerns #836

Merged
merged 2 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module WasteCarriersEngine
module CannotGoBackForm
extend ActiveSupport::Concern

included do
# Override this method as user shouldn't be able to go back from this page
def go_back; end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module WasteCarriersEngine
module UnsubmittableForm
extend ActiveSupport::Concern

included do
# Override this method as user shouldn't be able to "submit" this page
def create; end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

module WasteCarriersEngine
class CannotRenewCompanyNoChangeFormsController < FormsController
include UnsubmittableForm

def new
super(CannotRenewCompanyNoChangeForm, "cannot_renew_company_no_change_form")
end

# Override this method as user shouldn't be able to "submit" this page
def create; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

module WasteCarriersEngine
class CannotRenewLowerTierFormsController < FormsController
include UnsubmittableForm

def new
super(CannotRenewLowerTierForm, "cannot_renew_lower_tier_form")
end

# Override this method as user shouldn't be able to "submit" this page
def create; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

module WasteCarriersEngine
class CannotRenewTypeChangeFormsController < FormsController
include UnsubmittableForm

def new
super(CannotRenewTypeChangeForm, "cannot_renew_type_change_form")
end

# Override this method as user shouldn't be able to "submit" this page
def create; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class CopyCardsOrderCompletedFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(CopyCardsOrderCompletedForm, "copy_cards_order_completed_form")

OrderCopyCardsCompletionService.run(@transient_registration)
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class EditCancelledFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(EditCancelledForm, "edit_cancelled_form")

EditCancellationService.run(edit_registration: @transient_registration)
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class EditCompleteFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(EditCompleteForm, "edit_complete_form")

EditCompletionService.run(edit_registration: @transient_registration)
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module WasteCarriersEngine
class RegistrationCompletedFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(RegistrationCompletedForm, "registration_completed_form")

Expand All @@ -12,10 +15,5 @@ def new
Rails.logger.error e
end
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module WasteCarriersEngine
class RegistrationReceivedPendingConvictionFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(RegistrationReceivedPendingConvictionForm, "registration_received_pending_conviction_form")

Expand All @@ -12,10 +15,5 @@ def new
Rails.logger.error e
end
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module WasteCarriersEngine
class RegistrationReceivedPendingPaymentFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(RegistrationReceivedPendingPaymentForm, "registration_received_pending_payment_form")

Expand All @@ -12,10 +15,5 @@ def new
Rails.logger.error e
end
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module WasteCarriersEngine
class RegistrationReceivedPendingWorldpayPaymentFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

def new
return unless super(
RegistrationReceivedPendingWorldpayPaymentForm,
Expand All @@ -15,10 +18,5 @@ def new
Rails.logger.error e
end
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module WasteCarriersEngine
class RenewalCompleteFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

helper JourneyLinksHelper

def new
Expand All @@ -15,10 +18,5 @@ def new
Rails.logger.error e
end
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class RenewalReceivedFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

helper JourneyLinksHelper

def new
super(RenewalReceivedForm, "renewal_received_form")
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class RenewalReceivedPendingConvictionFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

helper JourneyLinksHelper

def new
super(RenewalReceivedPendingConvictionForm, "renewal_received_pending_conviction_form")
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class RenewalReceivedPendingPaymentFormsController < FormsController
include UnsubmittableForm
include CannotGoBackForm

helper JourneyLinksHelper

def new
super(RenewalReceivedPendingPaymentForm, "renewal_received_pending_payment_form")
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

module WasteCarriersEngine
class RenewalReceivedPendingWorldpayPaymentFormsController < FormsController
include CannotGoBackForm
include UnsubmittableForm

helper JourneyLinksHelper

def new
super(RenewalReceivedPendingWorldpayPaymentForm, "renewal_received_pending_worldpay_payment_form")
end

# Overwrite create and go_back as you shouldn't be able to submit or go back
def create; end

def go_back; end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# rubocop:disable Metrics/ClassLength
module WasteCarriersEngine
class WorldpayFormsController < FormsController
include UnsubmittableForm

def new
super(WorldpayForm, "worldpay_form")

Expand All @@ -16,8 +18,6 @@ def new
end
end

def create; end

def success
find_or_initialize_transient_registration(params[:token])

Expand Down