Sha256: 0f20aebeb7c31b3a4842b86ce385ae12d046c2b57279b0fce61b17aadb9202d9

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 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 = ::I18n.t(:'refinery.plugins.refinerycms_copywriting.title')
          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.3 lib/refinery/copywriting/engine.rb