Module: Locomotive::Concerns::UrlHelpersController

Extended by:
ActiveSupport::Concern
Included in:
BaseController
Defined in:
app/controllers/locomotive/concerns/url_helpers_controller.rb

Instance Method Summary collapse

Instance Method Details

#current_site_public_urlObject



11
12
13
14
# File 'app/controllers/locomotive/concerns/url_helpers_controller.rb', line 11

def current_site_public_url
  # by convention, a public site is displayed in http not https.
  'http://' + request.host_with_port
end

#public_page_url(page, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/locomotive/concerns/url_helpers_controller.rb', line 16

def public_page_url(page, options = {})
  # Rails.logger.debug "[public_page_url] =====> #{page.attributes.inspect} / #{page.fullpath.inspect} / #{current_site_public_url}\n\n"

  locale    = options[:locale]
  fullpath  = current_site.localized_page_fullpath(page, locale)

  if content = options.delete(:content)
    fullpath = fullpath.gsub('content_type_template', content._slug)
  end

  File.join(current_site_public_url, fullpath)
end