Sha256: d5496911829ba5240dcc43dbff5f8c65fc3e87151db25a81192dc1f183b6d3e9

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require 'rails'
require 'ckeditor'

module Ckeditor
  class Engine < ::Rails::Engine
    isolate_namespace Ckeditor
    
    config.action_view.javascript_expansions[:ckeditor] = "ckeditor/ckeditor"
    
    initializer "ckeditor.assets_precompile", :group => :assets do |app|
      app.config.assets.precompile += Ckeditor.assets
    end
    
    initializer "ckeditor.helpers" do
      ActiveSupport.on_load(:action_controller) do
        ActionController::Base.send :include, Ckeditor::Helpers::Controllers
      end
    
      ActiveSupport.on_load :action_view do
        ActionView::Base.send :include, Ckeditor::Helpers::ViewHelper
        ActionView::Base.send :include, Ckeditor::Helpers::FormHelper
        ActionView::Helpers::FormBuilder.send :include, Ckeditor::Helpers::FormBuilder
      end
    end
    
    initializer "ckeditor.hooks" do
      # Don't load the hook for Formtastic < 2.0.0 that (it crashes), apparently, didn't define a Formtastic::Inputs.
      if Object.const_defined?("Formtastic") && Formtastic.const_defined?("Inputs")
        require "ckeditor/hooks/formtastic"
      end
      
      if Object.const_defined?("SimpleForm")
        require "ckeditor/hooks/simple_form"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
glebtv-ckeditor-4.0.1 lib/ckeditor/engine.rb
lafeber_ckeditor-3.7.3 lib/ckeditor/engine.rb
ckeditor-3.7.3 lib/ckeditor/engine.rb
ckeditor-3.7.2 lib/ckeditor/engine.rb
ckeditor-3.7.1 lib/ckeditor/engine.rb