Browse Source

Merge pull request #49 from bikebike/godwin

Fixed error pages
development
Godwin 9 years ago
parent
commit
d334384a74
  1. 2
      app/controllers/application_controller.rb
  2. 3
      app/helpers/application_helper.rb
  3. 1
      config/application.rb
  4. 1
      config/routes.rb

2
app/controllers/application_controller.rb

@ -78,6 +78,7 @@ class ApplicationController < LinguaFrancaApplicationController
end end
def do_404 def do_404
params[:action] = 'error-403'
render 'application/404', status: 404 render 'application/404', status: 404
end end
@ -87,6 +88,7 @@ class ApplicationController < LinguaFrancaApplicationController
def do_403(template = nil) def do_403(template = nil)
@template = template @template = template
params[:action] = 'error-403'
render 'application/permission_denied', status: 403 render 'application/permission_denied', status: 403
end end

3
app/helpers/application_helper.rb

@ -122,8 +122,7 @@ module ApplicationHelper
@@body_class << (c.is_a?(Array) ? c.join(' ') : c) @@body_class << (c.is_a?(Array) ? c.join(' ') : c)
end end
def page_style#(style) def page_style
#classes = ['page-style-' + style.to_s]
classes = Array.new classes = Array.new
classes << 'has-translations' if ThereAreTranslationsOnThisPage? classes << 'has-translations' if ThereAreTranslationsOnThisPage?

1
config/application.rb

@ -29,6 +29,7 @@ module BikeBike
config.i18n.enforce_available_locales = false config.i18n.enforce_available_locales = false
self.paths['config/database'] = Rails.root.join('config', 'database.yml') self.paths['config/database'] = Rails.root.join('config', 'database.yml')
config.active_record.raise_in_transactional_callbacks = true config.active_record.raise_in_transactional_callbacks = true
config.exceptions_app = self.routes
if Rails.env == 'development' || Rails.env == 'test' if Rails.env == 'development' || Rails.env == 'test'
I18n.config.language_detection_method = I18n::Config::DETECT_LANGUAGE_FROM_URL_PARAM I18n.config.language_detection_method = I18n::Config::DETECT_LANGUAGE_FROM_URL_PARAM

1
config/routes.rb

@ -47,6 +47,7 @@ BikeBike::Application.routes.draw do
post '/translator-request' => 'application#translator_request', :as => :translator_request post '/translator-request' => 'application#translator_request', :as => :translator_request
get '/error_404' => 'application#error_404' get '/error_404' => 'application#error_404'
get '/404' => 'application#error_404'
get '/about' => 'application#about', :as => :about get '/about' => 'application#about', :as => :about
get '/policy' => 'application#policy', :as => :policy get '/policy' => 'application#policy', :as => :policy
root 'application#home', :as => :home root 'application#home', :as => :home

Loading…
Cancel
Save