Wednesday, February 11, 2009

RubyonRails: How to Integrate Comatose CMS & FCKEditor tutorial in your rails application

Steps

Install CMS Comatose plugin

$ script/plugin install http://comatose-plugin.googlecode.com/svn/trunk/comatose
$ script/plugin install git://github.com/darthapo/comatose.git (For Rails 2.X)

$ script/generate comatose_migration
$ rake db:migrate


Dependencias


$ ruby script/plugin install git://github.com/rails/acts_as_list
$ ruby script/plugin install git://github.com/rails/acts_as_tree


Install FCKEditor Plugin


$ script/plugin install git://github.com/davividal/fckeditor.git


Install views in our project

$ rake comatose:admin:customize

Edit "app/views/comatose_admin/_form.rhtml"

replace:


<%= f.text_area :body, :rows=>20, :tabindex=>2 %>


with:



<%= fckeditor_textarea('page', 'body', :width => '100%', :height => '500px') %>


Add FCKEditor javascript file to

app/views/layouts/comatose_admin.rhtml

<%= javascript_include_tag :fckeditor %>

Configure FCKEditor to accept other other Files Types like "PDF".

/vendor/plugins/fckeditor/app/controllers/fckeditor_controller.rb
MIME_TYPES = [
"image/jpg",
"image/jpeg",
"image/pjpeg",
"image/gif",
"image/png",
"application/x-shockwave-flash"
]

Comatose Configurations in config/initializers/comatose.rb

Comatose.configure do |config|

config.admin_title = 'Administration'
config.admin_helpers = []
config.admin_sub_title = 'Administration Pages'
config.content_type = 'utf-8'
config.default_filter = ''
config.default_processor = :liquid
config.default_tree_level = 3
config.disable_caching = false
config.hidden_meta_fields = 'filter'
config.helpers = []
config.includes = []

# These are 'blockable' settings
config.authorization = Proc.new { true }
config.admin_get_author = Proc.new { request.env['REMOTE_ADDR'] }
config.after_setup = Proc.new { true }


# Includes AuthenticationSystem in the ComatoseAdminController
#config.admin_includes << :authenticated_system

# Calls :login_required as a before_filter
#config.admin_authorization = :login_required

end

1 comment:

奔走比你 said...

It really helps! thank you!