Sha256: 09cab35b0838dac902cdf86e2944800a79b3beba8e2bf32f0985c574b762bd23

Contents?: true

Size: 849 Bytes

Versions: 29

Compression:

Stored size: 849 Bytes

Contents

module Locomotive
  module Concerns
    module UrlHelpersController

      extend ActiveSupport::Concern

      included do
        helper_method :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 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

29 entries across 29 versions & 1 rubygems

Version Path
locomotivecms-3.4.1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.4.0 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.3.0 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.3.0.rc3 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.3.0.rc2 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.1.2 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.2.1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.3.0.rc1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.2.0 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.2.0.rc2 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.2.0.rc1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.1.1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.1.0 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.1.0.rc3 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.1.0.rc2 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.1.0.rc1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.0.1 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.0.0 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.0.0.rc7 app/controllers/locomotive/concerns/url_helpers_controller.rb
locomotivecms-3.0.0.rc6 app/controllers/locomotive/concerns/url_helpers_controller.rb