Sha256: 081382f461c328bfc659f100c3e2b73db2ee889d6805f1c8e9d248116d1b0d1a

Contents?: true

Size: 1006 Bytes

Versions: 11

Compression:

Stored size: 1006 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

    def should_write_to_page_cache?
      using_cms_subdomains?
    end

    private

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

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
browsercms-3.5.7 lib/cms/domain_support.rb
browsercms-3.5.6 lib/cms/domain_support.rb
browsercms-3.5.5 lib/cms/domain_support.rb
browsercms-3.5.4 lib/cms/domain_support.rb
browsercms-3.5.3 lib/cms/domain_support.rb
browsercms-3.5.2 lib/cms/domain_support.rb
browsercms-3.5.1 lib/cms/domain_support.rb
browsercms-3.5.0 lib/cms/domain_support.rb
browsercms-3.5.0.rc3 lib/cms/domain_support.rb
browsercms-3.5.0.rc2 lib/cms/domain_support.rb
browsercms-3.5.0.rc1 lib/cms/domain_support.rb