public
Description: Fork of Scott Rutherford's excellent fckeditor Rails plugin, with easy upload image plugin of Alfonso Martínez de Lizarrondo
Homepage:
Clone URL: git://github.com/gramos/easy-fckeditor.git
Click here to lend your support to: easy-fckeditor and make a donation at www.pledgie.com !
easy-fckeditor / init.rb
100644 36 lines (28 sloc) 1.122 kb
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
33
34
35
36
# Include hook code here
require 'fckeditor'
require 'fckeditor_version'
require 'fckeditor_file_utils'
 
FckeditorFileUtils.check_and_install
 
# make plugin controller available to app
config.load_paths += %W(#{Fckeditor::PLUGIN_CONTROLLER_PATH} #{Fckeditor::PLUGIN_HELPER_PATH})
 
Rails::Initializer.run(:set_load_path, config)
 
ActionView::Base.send(:include, Fckeditor::Helper)
 
# require the controller
require 'fckeditor_controller'
 
# add a route for spellcheck
class ActionController::Routing::RouteSet
  unless (instance_methods.include?('draw_with_fckeditor'))
    class_eval <<-"end_eval", __FILE__, __LINE__
alias draw_without_fckeditor draw
def draw_with_fckeditor
draw_without_fckeditor do |map|
map.connect 'fckeditor/check_spelling', :controller => 'fckeditor', :action => 'check_spelling'
map.connect 'fckeditor/command', :controller => 'fckeditor', :action => 'command'
map.connect 'fckeditor/upload', :controller => 'fckeditor', :action => 'upload'
yield map
end
end
alias draw draw_with_fckeditor
end_eval
  end
end