From 13541537cc8bcfa2fb6be03c548be43fa82212b8 Mon Sep 17 00:00:00 2001 From: Godwin Date: Tue, 10 May 2016 18:43:46 -0700 Subject: [PATCH] Fixed error pages --- app/controllers/application_controller.rb | 2 ++ app/helpers/application_helper.rb | 3 +-- config/application.rb | 1 + config/routes.rb | 9 +++++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f0c201a..08a2b76 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -78,6 +78,7 @@ class ApplicationController < LinguaFrancaApplicationController end def do_404 + params[:action] = 'error-403' render 'application/404', status: 404 end @@ -87,6 +88,7 @@ class ApplicationController < LinguaFrancaApplicationController def do_403(template = nil) @template = template + params[:action] = 'error-403' render 'application/permission_denied', status: 403 end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dcc9935..c5d78e6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -122,8 +122,7 @@ module ApplicationHelper @@body_class << (c.is_a?(Array) ? c.join(' ') : c) end - def page_style#(style) - #classes = ['page-style-' + style.to_s] + def page_style classes = Array.new classes << 'has-translations' if ThereAreTranslationsOnThisPage? diff --git a/config/application.rb b/config/application.rb index d2786d1..314bd75 100644 --- a/config/application.rb +++ b/config/application.rb @@ -29,6 +29,7 @@ module BikeBike config.i18n.enforce_available_locales = false self.paths['config/database'] = Rails.root.join('config', 'database.yml') config.active_record.raise_in_transactional_callbacks = true + config.exceptions_app = self.routes if Rails.env == 'development' || Rails.env == 'test' I18n.config.language_detection_method = I18n::Config::DETECT_LANGUAGE_FROM_URL_PARAM diff --git a/config/routes.rb b/config/routes.rb index 23d241b..86db55e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,9 +46,10 @@ BikeBike::Application.routes.draw do post '/logout' => 'application#user_logout', :as => :logout post '/translator-request' => 'application#translator_request', :as => :translator_request - get '/error_404' => 'application#error_404' - get '/about' => 'application#about', :as => :about - get '/policy' => 'application#policy', :as => :policy - root 'application#home', :as => :home + get '/error_404' => 'application#error_404' + get '/404' => 'application#error_404' + get '/about' => 'application#about', :as => :about + get '/policy' => 'application#policy', :as => :policy + root 'application#home', :as => :home end