Browse Source

Fixed error pages

development
Godwin 9 years ago
parent
commit
13541537cc
  1. 2
      app/controllers/application_controller.rb
  2. 3
      app/helpers/application_helper.rb
  3. 1
      config/application.rb
  4. 9
      config/routes.rb

2
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

3
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?

1
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

9
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

Loading…
Cancel
Save