Sha256: c07a8db647d8fa9b24341b77c9d4378e6f1b64a56dd5b439ba0666f4e04d4282

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'active_record/associations'
require 'dispatcher'

module Cms
  autoload :Context, 'liquid_cms/context'
  autoload :ContextAssociation, 'liquid_cms/context_association'
  autoload :Association, 'association'

  mattr_reader :context_class
  def self.context_class=(klass)
    @@context_class = klass
    return if klass.nil? || ENV['NO_CONTEXT'] == 'true'

    Dispatcher.to_prepare {
      eval(klass.to_s).extend Cms::ContextAssociation

      Cms::Page.belongs_to  :context, :class_name => klass.to_s
      Cms::Asset.belongs_to :context, :class_name => klass.to_s
    }
  end
  @@context_class = nil

  def self.set_context(context, bind_to)
    return if @@context_class.nil?
    bind_to.instance_variable_set :@cms_context, context
  end

  def self.global_route(route_map)
    route_map.connect '*url', :controller => 'cms/pages', :action => 'load'
  end

  mattr_reader :valid_component_exts
  def self.valid_component_exts=(exts)
    @@valid_component_exts = exts.to_a
  end
  @@valid_component_exts = %w(.css .js .png .jpg .jpeg .gif .json .xml .fla .ico .txt)

  mattr_reader :editable_component_exts
  def self.editable_component_exts=(exts)
    @@editable_component_exts = exts.to_a
  end
  @@editable_component_exts = %w(.js .css .html .xml .txt)

  def self.setup
    yield self
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
liquid_cms-0.2.2.0 lib/liquid_cms/configuration.rb
liquid_cms-0.2.1.1 lib/liquid_cms/configuration.rb
liquid_cms-0.2.1.0 lib/liquid_cms/configuration.rb