Module: Locomotive::ActionController::UrlHelpers
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController, Public::BaseController
- Defined in:
- lib/locomotive/action_controller/url_helpers.rb
Instance Method Summary collapse
- #current_site_public_url ⇒ Object
- #public_page_url(page, options = {}) ⇒ Object
- #switch_to_site_url(site, options = {}) ⇒ Object
Instance Method Details
#current_site_public_url ⇒ Object
11 12 13 |
# File 'lib/locomotive/action_controller/url_helpers.rb', line 11 def current_site_public_url request.protocol + request.host_with_port end |
#public_page_url(page, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/locomotive/action_controller/url_helpers.rb', line 26 def public_page_url(page, = {}) # Rails.logger.debug "[public_page_url] =====> #{page.attributes.inspect} / #{page.fullpath.inspect}\n\n" if content = .delete(:content) File.join(current_site_public_url, page.fullpath.gsub('content_type_template', ''), content._slug) else File.join(current_site_public_url, page.fullpath) end end |
#switch_to_site_url(site, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/locomotive/action_controller/url_helpers.rb', line 15 def switch_to_site_url(site, = {}) = { :fullpath => true, :protocol => true }.merge() url = "#{site.subdomain}.#{Locomotive.config.domain}" url += ":#{request.port}" if request.port != 80 url = File.join(url, request.fullpath) if [:fullpath] url = "http://#{url}" if [:protocol] url end |