Sha256: 48f94dfa3fc0f2d2b1f91497341cb32bdd183fb88beddf34959e047bfe47102c

Contents?: true

Size: 1.61 KB

Versions: 5

Compression:

Stored size: 1.61 KB

Contents

module AlchemyCrm
  class Engine < Rails::Engine

    isolate_namespace AlchemyCrm
    engine_name 'alchemy_crm'

    initializer 'alchemy_crm.register_as_alchemy_module' do
      Alchemy::Modules.register_module(YAML.load_file(File.join(File.dirname(__FILE__), '../..', 'config/module_definition.yml')))
    end

    # Loading authorization rules and register them to auth engine instance
    initializer "alchemy_crm.add_authorization_rules" do
      Alchemy::AuthEngine.get_instance.load(File.join(File.dirname(__FILE__), '../..', 'config/authorization_rules.rb'))
    end

    initializer "alchemy_crm.add_newsletter_layouts" do
      newsletter_layouts_file = Rails.root.join('config', 'alchemy', 'newsletter_layouts.yml')
      if File.exist? newsletter_layouts_file
        YAML.load_file(newsletter_layouts_file).each do |newsletter_layout|
          newsletter_layout['name'] = Mailing::MAILING_PAGE_LAYOUT_PREFIX + newsletter_layout['name']
          Alchemy::PageLayout.add(newsletter_layout.merge({'newsletter' => true}))
        end
      else
        puts "!!! Alchemy CRM Warning: Newsletter Layouts File not found!\nPlease run 'rails generate alchemy_crm:scaffold' or create a 'newsletter_layouts.yml' file in config/alchemy folder."
      end
    end

    # initializer "alchemy_crm.inject_helpers" do
    #   ActionView::Base.send :include, AlchemyCrm::BaseHelper
    # end

    # Loading all alchemy core extensions found in app folder.
    config.to_prepare do
      Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_extension.rb")) do |e|
        Rails.env.production? ? require(e) : load(e)
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alchemy_crm-2.0.5 lib/alchemy_crm/engine.rb
alchemy_crm-2.0.4.1 lib/alchemy_crm/engine.rb
alchemy_crm-2.1.0a lib/alchemy_crm/engine.rb
alchemy_crm-2.0.3 lib/alchemy_crm/engine.rb
alchemy_crm-2.0.2 lib/alchemy_crm/engine.rb