basic suport for subdirectories

This commit is contained in:
John Bintz 2012-06-20 10:28:10 -04:00
parent fbcda9cdd6
commit 07f868594a
4 changed files with 14 additions and 4 deletions

View File

@ -7,7 +7,7 @@
= render 'locomotive/shared/actions/contents' = render 'locomotive/shared/actions/contents'
- content_for :buttons do - content_for :buttons do
= local_action_button :show, "/#{@page.fullpath}", :class => 'show' = local_action_button :show, current_site_public_url + '/' + @page.fullpath, :class => 'show'
%p!= t('.help') %p!= t('.help')

View File

@ -126,6 +126,15 @@ module Locomotive
Rails.application.routes.named_routes[:locomotive].path.spec.to_s Rails.application.routes.named_routes[:locomotive].path.spec.to_s
end end
def self.url_for(path)
result = path
if config.base_uri
result = "#{config.base_uri}/#{path.gsub(%r{^/}, '')}"
end
result = "/#{result}" if result[0..0] != '/'
result
end
protected protected
def self.app_middleware def self.app_middleware

View File

@ -9,7 +9,7 @@ module Locomotive
end end
def current_site_public_url def current_site_public_url
request.protocol + request.host_with_port request.protocol + request.host_with_port + (Locomotive.config.base_uri || '')
end end
def switch_to_site_url(site, options = {}) def switch_to_site_url(site, options = {})

View File

@ -13,6 +13,7 @@ module Locomotive
:enable_logs => false, :enable_logs => false,
:delayed_job => false, :delayed_job => false,
:default_locale => :en, :default_locale => :en,
:base_uri => nil,
:mailer_sender => 'support@example.com', :mailer_sender => 'support@example.com',
:manage_subdomain => false, :manage_subdomain => false,
:manage_manage_domains => false, :manage_manage_domains => false,