Permalink
Browse files

Make it possible to modify ckeditor options form the form helpers

  • Loading branch information...
cjheath committed Apr 5, 2011
1 parent 4ac7482 commit 77a9645cd41972dae21f9e1c47c6809de5f08da0
Showing with 7 additions and 5 deletions.
  1. +1 −0 README.rdoc
  2. +6 −5 lib/ckeditor/view_helper.rb
View
@@ -103,6 +103,7 @@ FormBuilder helper for more usefully:
:swf_params # SWFUpload additional params (Hash)
:id # textarea DOM element id
:index # element id index
+ :ckeditor_options # A hash allowing you to change filebrowserBrowseUrl, etc
For configure ckeditor default options check:
public/javascripts/ckeditor/config.js
@@ -34,18 +34,19 @@ def ckeditor_textarea(object, field, options = {})
textarea_options[:class] = (options.delete(:class) || 'editor').to_s
textarea_options[:style] = "width:#{width};height:#{height}"
- ckeditor_options = {:width => width, :height => height }
+ ckeditor_options = {:width => width, :height => height }.
+ merge(options.delete(:ckeditor_options)||{})
ckeditor_options[:language] = (options.delete(:language) || I18n.locale).to_s
ckeditor_options[:toolbar] = options.delete(:toolbar) if options[:toolbar]
ckeditor_options[:skin] = options.delete(:skin) if options[:skin]
ckeditor_options[:swf_params] = options.delete(:swf_params) if options[:swf_params]
- ckeditor_options[:filebrowserBrowseUrl] = Ckeditor.file_manager_uri
- ckeditor_options[:filebrowserUploadUrl] = Ckeditor.file_manager_upload_uri
+ ckeditor_options[:filebrowserBrowseUrl] ||= Ckeditor.file_manager_uri
+ ckeditor_options[:filebrowserUploadUrl] ||= Ckeditor.file_manager_upload_uri
- ckeditor_options[:filebrowserImageBrowseUrl] = Ckeditor.file_manager_image_uri
- ckeditor_options[:filebrowserImageUploadUrl] = Ckeditor.file_manager_image_upload_uri
+ ckeditor_options[:filebrowserImageBrowseUrl] ||= Ckeditor.file_manager_image_uri
+ ckeditor_options[:filebrowserImageUploadUrl] ||= Ckeditor.file_manager_image_upload_uri
output_buffer = ActiveSupport::SafeBuffer.new

0 comments on commit 77a9645

Please sign in to comment.