Fixed 404 and 403 errors

This commit is contained in:
Godwin 2016-12-25 09:10:49 -08:00
parent 92a9224716
commit ec06059ce5
8 changed files with 73 additions and 36 deletions

View File

@ -34,4 +34,18 @@ class AdminController < ApplicationController
redirect_to conference_url(conference.slug)
end
rescue_from ActiveRecord::PremissionDenied do |exception|
if logged_in?
redirect_to :register
else
@register_template = :confirm_email
@page_title = "articles.conference_registration.headings.#{@this_conference.registration_status == :open ? '': 'Pre_'}Registration_Details"
render :register
end
end
rescue_from ActiveRecord::RecordNotFound do |exception|
do_404
end
end

View File

@ -77,6 +77,10 @@ class ConferenceAdministrationController < ApplicationController
end
end
rescue_from ActiveRecord::RecordNotFound do |exception|
do_404
end
private
# Administration form pages
def administrate_administrators

View File

@ -306,8 +306,8 @@ class ConferencesController < ApplicationController
end
helper_method :registration_steps
helper_method :current_registration_steps
# helper_method :registration_steps
# helper_method :current_registration_steps
helper_method :registration_complete?
def registration_steps(conference = nil)
@ -360,36 +360,6 @@ class ConferencesController < ApplicationController
return true
end
def current_registration_steps(registration = @registration)
return nil unless registration.present?
steps = registration_steps(registration.conference)
current_steps = []
disable_steps = false
completed_steps = registration.steps_completed || []
registration_complete = registration_complete?(registration)
steps.each do | step |
# disable the step if we've already found an incomplete step
enabled = !disable_steps || registration_complete
# record whether or not we've found an incomplete step
disable_steps ||= !completed_steps.include?(step.to_s)
current_steps << {
name: step,
enabled: enabled
}
end
return current_steps
end
def current_step(registration = @registration)
completed_steps = registration.steps_completed || []
(registration_steps(registration.conference) || []).each do | step |
return step unless completed_steps.include?(step.to_s)
end
return registration_steps(registration.conference).last
end
rescue_from ActiveRecord::PremissionDenied do |exception|
if logged_in?
redirect_to :register
@ -400,6 +370,10 @@ class ConferencesController < ApplicationController
end
end
rescue_from ActiveRecord::RecordNotFound do |exception|
do_404
end
private
def PayPal!

View File

@ -352,4 +352,19 @@ class WorkshopsController < ApplicationController
return redirect_to view_workshop_url(@this_conference.slug, workshop.id, anchor: "comment-#{new_comment.id}")
end
rescue_from ActiveRecord::PremissionDenied do |exception|
if logged_in?
redirect_to 'conferences/register'
else
@register_template = :confirm_email
@page_title = "articles.conference_registration.headings.#{@this_conference.registration_status == :open ? '': 'Pre_'}Registration_Details"
render 'conferences/register'
end
end
rescue_from ActiveRecord::RecordNotFound do |exception|
do_404
end
end

View File

@ -1,7 +1,7 @@
require 'redcarpet'
module ApplicationHelper
include ScheduleHelper
include RegistrationHelper
@@keyQueue = nil
@@translationsOnThisPage = nil

View File

@ -0,0 +1,31 @@
module RegistrationHelper
def current_registration_steps(registration = @registration)
return nil unless registration.present?
steps = registration_steps(registration.conference)
current_steps = []
disable_steps = false
completed_steps = registration.steps_completed || []
registration_complete = registration_complete?(registration)
steps.each do | step |
# disable the step if we've already found an incomplete step
enabled = !disable_steps || registration_complete
# record whether or not we've found an incomplete step
disable_steps ||= !completed_steps.include?(step.to_s)
current_steps << {
name: step,
enabled: enabled
}
end
return current_steps
end
def current_step(registration = @registration)
completed_steps = registration.steps_completed || []
(registration_steps(registration.conference) || []).each do | step |
return step unless completed_steps.include?(step.to_s)
end
return registration_steps(registration.conference).last
end
end

View File

@ -1,5 +1,4 @@
= render :partial => 'page_header', :locals => {:page_key => 'Conference_Administration'}
= render :partial => 'conferences/page_header', :locals => {:page_key => 'Conference_Administration'}
- if @warnings.present?
= row class: 'warnings', tag: :ul do
- @warnings.each do | warning |
@ -10,4 +9,4 @@
= columns(medium: 12) do
%h2=_(@page_title)
= registration_step_menu
= render @register_template.to_s
= render "conferences/#{@register_template.to_s}"

BIN
pngquant.exe Normal file

Binary file not shown.