init.rb
上传用户:netsea168
上传日期:2022-07-22
资源大小:4652k
文件大小:1k
源码类别:

Ajax

开发平台:

Others

  1. # Include hook code here
  2. require 'ckeditor'
  3. require 'ckeditor_version'
  4. require 'ckeditor_file_utils'
  5. CkeditorFileUtils.check_and_install
  6. # make plugin controller available to app
  7. config.load_paths += %W(#{Ckeditor::PLUGIN_CONTROLLER_PATH} #{Ckeditor::PLUGIN_HELPER_PATH})
  8. Rails::Initializer.run(:set_load_path, config)
  9. ActionView::Base.send(:include, Ckeditor::Helper)
  10. # require the controller
  11. require 'ckeditor_controller'
  12. class ActionController::Routing::RouteSet
  13.   unless (instance_methods.include?('draw_with_ckeditor'))
  14.     class_eval <<-"end_eval", __FILE__, __LINE__  
  15.       alias draw_without_ckeditor draw
  16.       def draw_with_ckeditor
  17.         draw_without_ckeditor do |map|
  18.           map.connect 'ckeditor/command', :controller => 'ckeditor', :action => 'command'
  19.           map.connect 'ckeditor/upload', :controller => 'ckeditor', :action => 'upload'
  20.           yield map
  21.         end
  22.       end
  23.       alias draw draw_with_ckeditor
  24.     end_eval
  25.   end
  26. end