Sha256: 05228d210f1c2541859b8356f55ca3ed8ef8b0d9900ad9e66fca397619931bd1

Contents?: true

Size: 933 Bytes

Versions: 11

Compression:

Stored size: 933 Bytes

Contents

#
# A support module for handling detecting if a page or controller is being
# served by the public or cms domain.
#
module Cms
  module DomainSupport

    protected

    def cms_domain_prefix
      "cms"
    end

    def request_is_for_cms_subdomain?
      cms_site?
    end

    def cms_site?
      subdomains = request.subdomains
      subdomains.shift if subdomains.first == "www"
      subdomains.first == cms_domain_prefix
    end

    # Determines if users should be redirected between the public (www.) and admin (cms.) subdomains.
    def using_cms_subdomains?
      result = (wants_to_use_subdomains? && perform_caching)
      #Rails.logger.debug {"Are we using cms subdomains? #{result} based on 'want subdomain: #{wants_to_use_subdomains?}' and perform_caching: '#{perform_caching}'"}
      result
    end

    private

    def wants_to_use_subdomains?
      !Rails.configuration.cms.use_single_domain
    end

  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
browsercms-artirix-4.0.4 lib/cms/domain_support.rb
browsercms-artirix-4.0.3.3 lib/cms/domain_support.rb
browsercms-artirix-4.0.3.2 lib/cms/domain_support.rb
browsercms-artirix-4.0.3.1 lib/cms/domain_support.rb
browsercms-artirix-4.0.3 lib/cms/domain_support.rb
browsercms-artirix-4.0.2 lib/cms/domain_support.rb
browsercms-artirix-4.0.1.1 lib/cms/domain_support.rb
browsercms-artirix-4.0.0.rc1.art4 lib/cms/domain_support.rb
browsercms-4.0.0.rc1 lib/cms/domain_support.rb
browsercms-4.0.0.beta lib/cms/domain_support.rb
browsercms-4.0.0.alpha lib/cms/domain_support.rb