Improve Registration Flow Some:
* Trying to register when a ticket is required will now redirect you to buy tickets. * #64 will then redirect you back to complete the registration
This commit is contained in:
parent
62dd99b263
commit
d4a2861051
3 changed files with 7 additions and 3 deletions
|
|
@ -64,6 +64,9 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
notice: 'You are now registered and will be receiving E-Mail notifications.'
|
||||
end
|
||||
elsif @conference.registration_ticket_required? && !current_user.supports?(@conference)
|
||||
redirect_to conference_tickets_path(@conference.short_title),
|
||||
error: 'You must buy a registration ticket before registering.'
|
||||
else
|
||||
flash.now[:error] = "Could not create your registration for #{@conference.title}: "\
|
||||
"#{@registration.errors.full_messages.join('. ')}."
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ class Registration < ApplicationRecord
|
|||
end
|
||||
|
||||
def user_has_registration_ticket
|
||||
return if TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any?
|
||||
return if conference.registration_ticket_required? &&
|
||||
TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any?
|
||||
|
||||
errors.add(:base, 'You must purchase a registration ticket before registering')
|
||||
if TicketPurchase.where(user: user, ticket: conference.registration_tickets).unpaid.any?
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'spec_helper'
|
||||
|
||||
feature Registration do
|
||||
feature Registration, feature: true, js: true do
|
||||
let!(:ticket) { create(:ticket) }
|
||||
let!(:free_ticket) { create(:ticket, price_cents: 0) }
|
||||
let!(:first_registration_ticket) { create(:registration_ticket, price_cents: 0) }
|
||||
|
|
@ -146,7 +146,7 @@ feature Registration do
|
|||
|
||||
context 'who is registered' do
|
||||
|
||||
scenario 'unregisters from conference, but ticket purchases dont delete', feature: true, js: true do
|
||||
scenario 'unregisters from conference, but ticket purchases dont delete' do
|
||||
visit root_path
|
||||
click_link 'Register'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue