Sha256: cfdff42a94ceac3837350950da3842ad249e014485122b0e37d753eb93096f39

Contents?: true

Size: 927 Bytes

Versions: 11

Compression:

Stored size: 927 Bytes

Contents

require 'cms/engine_helper'

module Cms

  # All BrowserCMS modules will:
  # 1. Add app/portlets to the loadpath
  # 2. Serve static assets from their public directory.
  module Module

    def self.current_namespace=(ns)
      @ns = ns
    end

    def self.current_namespace
      @ns
    end

    def self.included(base)
      # Make sure class in app/portlets are in the load_path
      portlets_dir = File.join("..", "..", "app", "portlets")
      base.config.autoload_paths << portlets_dir
    end

    # This is a bit of a hack, but we need to store the current namespaces so that module developers can just write:
    #
    # BcmsZoo::Engine.routes.draw do
    #   <tt>content_blocks :bear</tt>
    # end
    #
    # And have it correctly find the right namespaced class model (i.e. BcmsZoo::Bear)
    def routes
      Module.current_namespace = ::Cms::EngineAware.module_name(self.class)
      super
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

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