Sha256: c68d9a9494efe9f5f22750dba52c71b34094720db802ea2f4e2496a915271b70

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

module Refinery
  module Copywriting
    class Engine < Rails::Engine
      include Refinery::Engine

      isolate_namespace Refinery::Copywriting

      config.autoload_paths += %W( #{config.root}/lib )

      config.to_prepare do
        ::Refinery::Page.module_eval do
          has_many :copywriting_phrases, :dependent => :destroy, :class_name => 'Refinery::Copywriting::Phrase'
          accepts_nested_attributes_for :copywriting_phrases, :allow_destroy => false
          attr_accessible :copywriting_phrases_attributes
        end
      end

      before_inclusion do
        ::ApplicationController.helper(CopywritingHelper)
      end

      initializer "register refinery_copywriting plugin", :after => :set_routes_reloader do |app|
        ::Refinery::Pages::Tab.register do |tab|
          tab.name = 'copywriting'
          tab.partial = '/refinery/pages/admin/tabs/copywriting'
        end

        Refinery::Plugin.register do |plugin|
          plugin.pathname = root
          plugin.name = 'refinerycms_copywriting'
          plugin.url = {:controller => '/refinery/copywriting/admin/phrases'}
          plugin.menu_match = /copywriting/
          plugin.activity = {
            :class_name => 'Refinery::Copywriting::Phrase',
            :title => :name
          }
        end
      end

      config.after_initialize do
        Refinery.register_engine(Refinery::Copywriting)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-copywriting-2.0.2 lib/refinery/copywriting/engine.rb