Browse Source

Fixed 404 and 403 errors

development
Godwin 8 years ago
parent
commit
ec06059ce5
  1. 14
      app/controllers/admin_controller.rb
  2. 4
      app/controllers/conference_administration_controller.rb
  3. 38
      app/controllers/conferences_controller.rb
  4. 15
      app/controllers/workshops_controller.rb
  5. 2
      app/helpers/application_helper.rb
  6. 31
      app/helpers/registration_helper.rb
  7. 5
      app/views/conferences/register.html.haml
  8. BIN
      pngquant.exe

14
app/controllers/admin_controller.rb

@ -34,4 +34,18 @@ class AdminController < ApplicationController
redirect_to conference_url(conference.slug) redirect_to conference_url(conference.slug)
end 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 end

4
app/controllers/conference_administration_controller.rb

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

38
app/controllers/conferences_controller.rb

@ -306,8 +306,8 @@ class ConferencesController < ApplicationController
end end
helper_method :registration_steps # helper_method :registration_steps
helper_method :current_registration_steps # helper_method :current_registration_steps
helper_method :registration_complete? helper_method :registration_complete?
def registration_steps(conference = nil) def registration_steps(conference = nil)
@ -360,36 +360,6 @@ class ConferencesController < ApplicationController
return true return true
end 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| rescue_from ActiveRecord::PremissionDenied do |exception|
if logged_in? if logged_in?
redirect_to :register redirect_to :register
@ -400,6 +370,10 @@ class ConferencesController < ApplicationController
end end
end end
rescue_from ActiveRecord::RecordNotFound do |exception|
do_404
end
private private
def PayPal! def PayPal!

15
app/controllers/workshops_controller.rb

@ -352,4 +352,19 @@ class WorkshopsController < ApplicationController
return redirect_to view_workshop_url(@this_conference.slug, workshop.id, anchor: "comment-#{new_comment.id}") return redirect_to view_workshop_url(@this_conference.slug, workshop.id, anchor: "comment-#{new_comment.id}")
end 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 end

2
app/helpers/application_helper.rb

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

31
app/helpers/registration_helper.rb

@ -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

5
app/views/conferences/register.html.haml

@ -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? - if @warnings.present?
= row class: 'warnings', tag: :ul do = row class: 'warnings', tag: :ul do
- @warnings.each do | warning | - @warnings.each do | warning |
@ -10,4 +9,4 @@
= columns(medium: 12) do = columns(medium: 12) do
%h2=_(@page_title) %h2=_(@page_title)
= registration_step_menu = registration_step_menu
= render @register_template.to_s = render "conferences/#{@register_template.to_s}"

BIN
pngquant.exe

Binary file not shown.
Loading…
Cancel
Save