extract about pgaes to own controller
This commit is contained in:
parent
883dd2b28e
commit
bb0cb2b0d2
|
@ -33,10 +33,10 @@ public/avatars
|
|||
public/sitemap*
|
||||
|
||||
# templates to be created per-site
|
||||
app/views/home/404.*
|
||||
app/views/home/about.*
|
||||
app/views/home/chat.*
|
||||
app/views/home/privacy.*
|
||||
app/views/about/404.*
|
||||
app/views/about/about.*
|
||||
app/views/about/chat.*
|
||||
app/views/about/privacy.*
|
||||
public/apple-touch-icon*
|
||||
public/favicon.ico
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
class AboutController < ApplicationController
|
||||
caches_page :about, :chat, if: CACHE_PAGE
|
||||
|
||||
def four_oh_four
|
||||
begin
|
||||
@title = "Resource Not Found"
|
||||
render :action => "404", :status => 404
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"<h1 class=\"title\">404</h1>" <<
|
||||
"Resource not found" <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
end
|
||||
|
||||
def about
|
||||
begin
|
||||
@title = "About"
|
||||
render :action => "about"
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"A mystery." <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
raise "Seriously, write your own about page." if @homeabout
|
||||
end
|
||||
|
||||
def chat
|
||||
begin
|
||||
@title = "Chat"
|
||||
render :action => "chat"
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"<h1 class=\"title\">Chat</h1>" <<
|
||||
"Keep it on-site" <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
end
|
||||
|
||||
def privacy
|
||||
begin
|
||||
@title = "Privacy Policy"
|
||||
render :action => "privacy"
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"You apparently have no privacy." <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,60 +1,13 @@
|
|||
class HomeController < ApplicationController
|
||||
include IntervalHelper
|
||||
|
||||
caches_page :about, :chat, :index, :newest, :newest_by_user, :recent, :top, if: CACHE_PAGE
|
||||
caches_page :index, :newest, :newest_by_user, :recent, :top, if: CACHE_PAGE
|
||||
|
||||
# for rss feeds, load the user's tag filters if a token is passed
|
||||
before_action :find_user_from_rss_token, :only => [:index, :newest, :saved, :upvoted]
|
||||
before_action { @page = page }
|
||||
before_action :require_logged_in_user, :only => [:upvoted]
|
||||
|
||||
def four_oh_four
|
||||
begin
|
||||
@title = "Resource Not Found"
|
||||
render :action => "404", :status => 404
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"<h1 class=\"title\">404</h1>" <<
|
||||
"Resource not found" <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
end
|
||||
|
||||
def about
|
||||
begin
|
||||
@title = "About"
|
||||
render :action => "about"
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"A mystery." <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
raise "Seriously, write your own about page." if @homeabout
|
||||
end
|
||||
|
||||
def chat
|
||||
begin
|
||||
@title = "Chat"
|
||||
render :action => "chat"
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"<h1 class=\"title\">Chat</h1>" <<
|
||||
"Keep it on-site" <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
end
|
||||
|
||||
def privacy
|
||||
begin
|
||||
@title = "Privacy Policy"
|
||||
render :action => "privacy"
|
||||
rescue ActionView::MissingTemplate
|
||||
render :html => ("<div class=\"box wide\">" <<
|
||||
"You apparently have no privacy." <<
|
||||
"</div>").html_safe, :layout => "application"
|
||||
end
|
||||
end
|
||||
|
||||
def hidden
|
||||
@stories, @show_more = get_from_cache(hidden: true) {
|
||||
paginate stories.hidden
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<div class="box wide">
|
||||
<h1 class="title">404</h1>
|
||||
|
||||
<div class="story_text">
|
||||
<p>
|
||||
The resource you requested was not found, or the story has been deleted.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -3,7 +3,7 @@ Rails.application.routes.draw do
|
|||
:protocol => (Rails.application.config.force_ssl ? "https://" : "http://"),
|
||||
:as => "root"
|
||||
|
||||
get "/404" => "home#four_oh_four", :via => :all
|
||||
get "/404" => "about#four_oh_four", :via => :all
|
||||
|
||||
get "/rss" => "home#index", :format => "rss"
|
||||
get "/hottest" => "home#index", :format => "json"
|
||||
|
@ -211,9 +211,9 @@ Rails.application.routes.draw do
|
|||
get "/mod/notes(/:period)" => "mod_notes#index", :as => "mod_notes"
|
||||
post "/mod/notes" => "mod_notes#create"
|
||||
|
||||
get "/privacy" => "home#privacy"
|
||||
get "/about" => "home#about"
|
||||
get "/chat" => "home#chat"
|
||||
get "/privacy" => "about#privacy"
|
||||
get "/about" => "about#about"
|
||||
get "/chat" => "about#chat"
|
||||
|
||||
get "/stats" => "stats#index"
|
||||
|
||||
|
|
Loading…
Reference in New Issue