Adding specific admin templates for the "no site" and "no page" errors.

Goal should be to use these to allow someone to create a new site right here
This commit is contained in:
Jacques Crocker 2010-09-21 04:45:34 -07:00
parent 48c917982c
commit 9097200339
6 changed files with 16 additions and 9 deletions

View File

@ -0,0 +1 @@
No Page!

View File

@ -0,0 +1 @@
No Site!

View File

@ -0,0 +1 @@
= yield

View File

@ -1,9 +1,9 @@
# Locomotive::Application.routes.draw do |map|
Rails.application.routes.draw do
constraints(Locomotive::Routing::DefaultConstraint) do
root :to => 'home#show'
end
# constraints(Locomotive::Routing::DefaultConstraint) do
# root :to => 'home#show'
# end
# admin authentication
devise_for :admin, :class_name => 'Account', :controllers => { :sessions => 'admin/sessions', :passwords => 'admin/passwords' }

View File

@ -13,7 +13,7 @@ module Locomotive
else
@page = locomotive_page
redirect_to application_root_url and return if @page.nil?
render_no_page_error and return if @page.nil?
output = @page.render(locomotive_context)
@ -21,6 +21,10 @@ module Locomotive
end
end
def render_no_page_error
render :template => "/admin/errors/no_page", :layout => false
end
def locomotive_page
path = (params[:path] || request.fullpath).clone
path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '')

View File

@ -26,7 +26,11 @@ module Locomotive
end
def require_site
redirect_to application_root_url and return false if current_site.nil?
render_no_site_error and return false if current_site.nil?
end
def render_no_site_error
render :template => "/admin/errors/no_site", :layout => false
end
def validate_site_membership
@ -34,10 +38,6 @@ module Locomotive
sign_out_and_redirect(current_admin)
end
def application_root_url
root_url(:host => Locomotive.config.default_domain, :port => request.port)
end
end
end