diff --git a/.gitignore b/.gitignore index a6be7571..1e1b9608 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb new file mode 100644 index 00000000..403cf064 --- /dev/null +++ b/app/controllers/about_controller.rb @@ -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 => ("
" << + "

404

" << + "Resource not found" << + "
").html_safe, :layout => "application" + end + end + + def about + begin + @title = "About" + render :action => "about" + rescue ActionView::MissingTemplate + render :html => ("
" << + "A mystery." << + "
").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 => ("
" << + "

Chat

" << + "Keep it on-site" << + "
").html_safe, :layout => "application" + end + end + + def privacy + begin + @title = "Privacy Policy" + render :action => "privacy" + rescue ActionView::MissingTemplate + render :html => ("
" << + "You apparently have no privacy." << + "
").html_safe, :layout => "application" + end + end +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 4c9162ee..450bffb4 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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 => ("
" << - "

404

" << - "Resource not found" << - "
").html_safe, :layout => "application" - end - end - - def about - begin - @title = "About" - render :action => "about" - rescue ActionView::MissingTemplate - render :html => ("
" << - "A mystery." << - "
").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 => ("
" << - "

Chat

" << - "Keep it on-site" << - "
").html_safe, :layout => "application" - end - end - - def privacy - begin - @title = "Privacy Policy" - render :action => "privacy" - rescue ActionView::MissingTemplate - render :html => ("
" << - "You apparently have no privacy." << - "
").html_safe, :layout => "application" - end - end - def hidden @stories, @show_more = get_from_cache(hidden: true) { paginate stories.hidden diff --git a/app/views/home/about.html.erb b/app/views/about/about.html.erb similarity index 100% rename from app/views/home/about.html.erb rename to app/views/about/about.html.erb diff --git a/app/views/home/chat.html.erb b/app/views/about/chat.html.erb similarity index 100% rename from app/views/home/chat.html.erb rename to app/views/about/chat.html.erb diff --git a/app/views/home/privacy.html.erb b/app/views/about/privacy.html.erb similarity index 100% rename from app/views/home/privacy.html.erb rename to app/views/about/privacy.html.erb diff --git a/app/views/home/404.html.erb b/app/views/home/404.html.erb deleted file mode 100644 index 430efe44..00000000 --- a/app/views/home/404.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
-

404

- -
-

- The resource you requested was not found, or the story has been deleted. -

-
-
diff --git a/config/routes.rb b/config/routes.rb index aed41c88..025d4f64 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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"