add a dynamic 404 page
This commit is contained in:
parent
f9d46c666b
commit
722189b6ac
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,6 +24,7 @@ upstream-patches
|
||||||
app/views/home/privacy.*
|
app/views/home/privacy.*
|
||||||
app/views/home/about.*
|
app/views/home/about.*
|
||||||
app/views/home/chat.*
|
app/views/home/chat.*
|
||||||
|
app/views/home/404.*
|
||||||
app/assets/stylesheets/local/*
|
app/assets/stylesheets/local/*
|
||||||
public/favicon.ico
|
public/favicon.ico
|
||||||
public/apple-touch-icon*
|
public/apple-touch-icon*
|
||||||
|
|
|
@ -4,11 +4,24 @@ class HomeController < ApplicationController
|
||||||
before_filter { @page = page }
|
before_filter { @page = page }
|
||||||
before_filter :require_logged_in_user, :only => [ :upvoted ]
|
before_filter :require_logged_in_user, :only => [ :upvoted ]
|
||||||
|
|
||||||
|
def four_oh_four
|
||||||
|
begin
|
||||||
|
@title = "Resource Not Found"
|
||||||
|
render :action => "404", :status => 404
|
||||||
|
rescue ActionView::MissingTemplate
|
||||||
|
render :text => "<div class=\"box wide\">" <<
|
||||||
|
"<div class=\"legend\">404</div>" <<
|
||||||
|
"Resource not found" <<
|
||||||
|
"</div>", :layout => "application"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def about
|
def about
|
||||||
begin
|
begin
|
||||||
@title = I18n.t 'controllers.home_controller.abouttitle'
|
@title = I18n.t 'controllers.home_controller.abouttitle'
|
||||||
render :action => "about"
|
render :action => "about"
|
||||||
rescue
|
rescue ActionView::MissingTemplate
|
||||||
render :text => I18n.t('controllers.home_controller.abouttext'), :layout => "application"
|
render :text => I18n.t('controllers.home_controller.abouttext'), :layout => "application"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,8 +30,9 @@ class HomeController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@title = I18n.t 'controllers.home_controller.chattitle'
|
@title = I18n.t 'controllers.home_controller.chattitle'
|
||||||
render :action => "chat"
|
render :action => "chat"
|
||||||
rescue
|
rescue ActionView::MissingTemplate
|
||||||
render :text => "<div class=\"box wide\">" <<
|
render :text => "<div class=\"box wide\">" <<
|
||||||
|
"<div class=\"legend\">Chat</div>" <<
|
||||||
"Keep it on-site" <<
|
"Keep it on-site" <<
|
||||||
"</div>", :layout => "application"
|
"</div>", :layout => "application"
|
||||||
end
|
end
|
||||||
|
@ -28,7 +42,7 @@ class HomeController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@title = I18n.t 'controllers.home_controller.privacytitle'
|
@title = I18n.t 'controllers.home_controller.privacytitle'
|
||||||
render :action => "privacy"
|
render :action => "privacy"
|
||||||
rescue
|
rescue ActionView::MissingTemplate
|
||||||
render :text => I18n.t('controllers.home_controller.licensetext'), :layout => "application"
|
render :text => I18n.t('controllers.home_controller.licensetext'), :layout => "application"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,6 +30,8 @@ module Lobsters
|
||||||
|
|
||||||
config.cache_store = :file_store, "#{config.root}/tmp/cache/"
|
config.cache_store = :file_store, "#{config.root}/tmp/cache/"
|
||||||
|
|
||||||
|
config.exceptions_app = self.routes
|
||||||
|
|
||||||
config.after_initialize do
|
config.after_initialize do
|
||||||
require "#{Rails.root}/lib/monkey.rb"
|
require "#{Rails.root}/lib/monkey.rb"
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,8 @@ Lobsters::Application.routes.draw do
|
||||||
:protocol => (Rails.application.config.force_ssl ? "https://" : "http://"),
|
:protocol => (Rails.application.config.force_ssl ? "https://" : "http://"),
|
||||||
:as => "root"
|
:as => "root"
|
||||||
|
|
||||||
|
get "/404" => "home#four_oh_four", :via => :all
|
||||||
|
|
||||||
get "/rss" => "home#index", :format => "rss"
|
get "/rss" => "home#index", :format => "rss"
|
||||||
get "/hottest" => "home#index", :format => "json"
|
get "/hottest" => "home#index", :format => "json"
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>404</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>gone fishin'</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in a new issue