Modify conference registration to a singular resource

This commit is contained in:
Arun Kumar 2016-07-05 00:10:18 +05:30
parent 8b831b1977
commit 0675572e05
No known key found for this signature in database
GPG key ID: 6C40CA6462DEA424
17 changed files with 37 additions and 37 deletions

View file

@ -10,7 +10,7 @@ class ConferenceRegistrationsController < ApplicationController
# Redirect to registration edit when user is already registered
if @conference.user_registered?(current_user)
redirect_to edit_conference_conference_registrations_path(@conference.short_title)
redirect_to edit_conference_conference_registration_path(@conference.short_title)
return
# ichain does not allow us to create users during registration
elsif (ENV['OSEM_ICHAIN_ENABLED'] == 'true') && !current_user
@ -20,7 +20,7 @@ class ConferenceRegistrationsController < ApplicationController
# avoid openid sign_in to redirect to register/new when the sign_in user had already a registration
if current_user && @conference.user_registered?(current_user)
redirect_to edit_conference_conference_registrations_path(@conference.short_title)
redirect_to edit_conference_conference_registration_path(@conference.short_title)
end
# @user variable needs to be set so that _sign_up_form_embedded works properly
@ -60,7 +60,7 @@ class ConferenceRegistrationsController < ApplicationController
redirect_to conference_tickets_path(@conference.short_title),
notice: 'You are now registered and will be receiving E-Mail notifications.'
else
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'You are now registered and will be receiving E-Mail notifications.'
end
else
@ -72,7 +72,7 @@ class ConferenceRegistrationsController < ApplicationController
def update
if @registration.update_attributes(registration_params)
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'Registration was successfully updated.'
else
flash[:error] = "Could not update your registration for #{@conference.title}: "\
@ -86,7 +86,7 @@ class ConferenceRegistrationsController < ApplicationController
redirect_to root_path,
notice: "You are not registered for #{@conference.title} anymore!"
else
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
error: "Could not delete your registration for #{@conference.title}: "\
"#{@registration.errors.full_messages.join('. ')}."
end
@ -97,7 +97,7 @@ class ConferenceRegistrationsController < ApplicationController
def set_registration
@registration = Registration.find_by(conference: @conference, user: current_user)
if !@registration
redirect_to new_conference_conference_registrations_path(@conference.short_title),
redirect_to new_conference_conference_registration_path(@conference.short_title),
error: "Can't find a registration for #{@conference.title} for you. Please register."
end
end

View file

@ -109,7 +109,7 @@ class ProposalController < ApplicationController
redirect_to conference_program_proposal_index_path(@conference.short_title),
notice: 'The proposal was confirmed.'
else
redirect_to new_conference_conference_registrations_path(conference_id: @conference.short_title),
redirect_to new_conference_conference_registration_path(conference_id: @conference.short_title),
alert: 'The proposal was confirmed. Please register to attend the conference.'
end
else

View file

@ -7,13 +7,13 @@ class TicketPurchasesController < ApplicationController
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
if message.blank?
if current_user.ticket_purchases.any?
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
notice: "Thank you for supporting #{@conference.title} by purchasing a ticket."
else
redirect_to conference_conference_registrations_path(@conference.short_title)
redirect_to conference_conference_registration_path(@conference.short_title)
end
else
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
error: "Oops, something went wrong with your purchase! #{message}"
end
end
@ -21,10 +21,10 @@ class TicketPurchasesController < ApplicationController
def destroy
@ticket_purchases = current_user.ticket_purchases.find(params[:id])
if @ticket_purchases.destroy
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'Ticket successfully deleted.'
else
redirect_to conference_conference_registrations_path(@conference.short_title),
redirect_to conference_conference_registration_path(@conference.short_title),
error: 'An error prohibited deleting your purchase! '\
"#{@ticket_purchases.errors.full_messages.join('. ')}."
end