Merge branch 'origin/nodefault'
This commit is contained in:
commit
c2766f0273
@ -3,7 +3,7 @@ module Admin
|
||||
|
||||
include Locomotive::Routing::SiteDispatcher
|
||||
|
||||
layout 'admin/application'
|
||||
layout '/admin/layouts/application'
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Admin
|
||||
class CrossDomainSessionsController < BaseController
|
||||
|
||||
layout 'admin/box'
|
||||
layout '/admin/layouts/box'
|
||||
|
||||
skip_before_filter :verify_authenticity_token
|
||||
|
||||
|
@ -3,7 +3,7 @@ module Admin
|
||||
|
||||
include Locomotive::Routing::SiteDispatcher
|
||||
|
||||
layout 'admin/box'
|
||||
layout '/admin/layouts/box'
|
||||
|
||||
before_filter :require_site
|
||||
|
||||
|
@ -3,7 +3,7 @@ module Admin
|
||||
|
||||
include Locomotive::Routing::SiteDispatcher
|
||||
|
||||
layout 'admin/box'
|
||||
layout '/admin/layouts/box'
|
||||
|
||||
before_filter :require_site
|
||||
|
||||
|
@ -6,6 +6,6 @@ class ApplicationController < ActionController::Base
|
||||
# rescue_from Exception, :with => :render_error
|
||||
#
|
||||
# def render_error
|
||||
# render :template => "/admin/errors/500", :layout => 'admin/box', :status => 500
|
||||
# render :template => "/admin/errors/500", :layout => '/admin/layouts/box', :status => 500
|
||||
# end
|
||||
end
|
||||
|
@ -1,7 +0,0 @@
|
||||
class HomeController < ApplicationController
|
||||
|
||||
def show; end
|
||||
|
||||
def unknown; end
|
||||
|
||||
end
|
1
app/views/admin/errors/no_page.html.haml
Normal file
1
app/views/admin/errors/no_page.html.haml
Normal file
@ -0,0 +1 @@
|
||||
No Page!
|
1
app/views/admin/errors/no_site.html.haml
Normal file
1
app/views/admin/errors/no_site.html.haml
Normal file
@ -0,0 +1 @@
|
||||
No Site!
|
1
app/views/admin/layouts/error.html.haml
Normal file
1
app/views/admin/layouts/error.html.haml
Normal file
@ -0,0 +1 @@
|
||||
= yield
|
@ -1,4 +0,0 @@
|
||||
%h2 Locomotive rocks !!!
|
||||
|
||||
%p
|
||||
= flash[:error]
|
@ -1,7 +0,0 @@
|
||||
!!! XML
|
||||
!!!
|
||||
%html{ :xmlns => 'http://www.w3.org/1999/xhtml' }
|
||||
%head
|
||||
%body
|
||||
%h1 Welcome to Locomotive
|
||||
= yield
|
@ -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' }
|
||||
|
@ -9,11 +9,11 @@ module Locomotive
|
||||
|
||||
def render_locomotive_page
|
||||
if request.fullpath =~ /^\/admin\//
|
||||
render :template => "/admin/errors/404", :layout => 'admin/box', :status => 404
|
||||
render :template => "/admin/errors/404", :layout => '/admin/layouts/box', :status => 404
|
||||
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 # TODO: params[:path] is more consistent
|
||||
path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user