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'
- 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')
@ -15,4 +15,4 @@
= render 'form', :f => form
= render 'locomotive/shared/form_actions', :back_url => pages_url, :button_label => :update
= render 'locomotive/shared/form_actions', :back_url => pages_url, :button_label => :update

View File

@ -126,6 +126,15 @@ module Locomotive
Rails.application.routes.named_routes[:locomotive].path.spec.to_s
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
def self.app_middleware

View File

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

View File

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