Sha256: 8a740f2afe2dc13a91c40de408ac085983e060c9dfc5af8ffc17e9dcfad1dd62
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module Locomotive module ActionController module UrlHelpers extend ActiveSupport::Concern included do helper_method :current_site_public_url, :switch_to_site_url, :public_page_url end def current_site_public_url # by convention, a public site is displayed in http not https. 'http://' + request.host_with_port end def switch_to_site_url(site, options = {}) options = { fullpath: true, protocol: true }.merge(options) url = "#{site.subdomain}.#{Locomotive.config.domain}" url += ":#{request.port}" if request.port != 80 url = File.join(url, request.fullpath) if options[:fullpath] url = "http://#{url}" if options[:protocol] url end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
locomotive_cms-2.5.7 | lib/locomotive/action_controller/url_helpers.rb |
locomotive_cms-2.5.6 | lib/locomotive/action_controller/url_helpers.rb |