forked from gramos/easy-fckeditor
-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.rb
33 lines (26 loc) · 970 Bytes
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Include hook code here
require 'ckeditor'
require 'ckeditor_version'
require 'ckeditor_file_utils'
CkeditorFileUtils.check_and_install
# make plugin controller available to app
config.load_paths += %W(#{Ckeditor::PLUGIN_CONTROLLER_PATH} #{Ckeditor::PLUGIN_HELPER_PATH})
Rails::Initializer.run(:set_load_path, config)
ActionView::Base.send(:include, Ckeditor::Helper)
# require the controller
require 'ckeditor_controller'
class ActionController::Routing::RouteSet
unless (instance_methods.include?('draw_with_ckeditor'))
class_eval <<-"end_eval", __FILE__, __LINE__
alias draw_without_ckeditor draw
def draw_with_ckeditor
draw_without_ckeditor do |map|
map.connect 'ckeditor/command', :controller => 'ckeditor', :action => 'command'
map.connect 'ckeditor/upload', :controller => 'ckeditor', :action => 'upload'
yield map
end
end
alias draw draw_with_ckeditor
end_eval
end
end