I have a script with a tinymce editor included.
But the editor doesn''t work at all.
Can somebody explain what is wrong.
In the application_helper
def in_place_rich_editor(field_id, options = {})
function = "new Ajax.InPlaceRichEditor("
function << "''#{field_id}'', "
function <<
"''#{url_for(options[:url])}''"
js_options = {}
js_options[''cancelText''] =
%(''#{options[:cancel_text]}'') if
options[:cancel_text]
js_options[''okText''] =
%(''#{options[:save_text]}'') if
options[:save_text]
js_options[''loadingText''] =
%(''#{options[:loading_text]}'') if
options[:loading_text]
js_options[''rows''] = options[:rows] if options[:rows]
js_options[''cols''] = options[:cols] if options[:cols]
js_options[''size''] = options[:size] if options[:size]
js_options[''size''] = options[:class] if
options[:class]
js_options[''externalControl'']
"''#{options[:external_control]}''" if
options[:external_control]
js_options[''loadTextURL'']
"''#{url_for(options[:load_text_url])}''" if
options[:load_text_url]
js_options[''ajaxOptions''] = options[:options] if
options[:options]
js_options[''evalScripts''] = options[:script] if
options[:script]
js_options[''callback''] = "function(form) {
return
#{options[:with]} }" if options[:with]
function << ('', '' +
options_for_javascript(js_options)) unless
js_options.empty?
function << '')''
javascript_tag(function)
end
In the controller
def save_editable
flash[:notice] = "Je bent aangemeld."
@editables = Page.find(:first, :conditions => "name
''Home''").editables
@editable = @editables.find(params[:id])
previous_content = @editable.html
@editable.html = params[:value]
@editable.html = previous_content unless
@editable.save
render :partial => @editable.name
end
In the view
<%= in_place_rich_editor( @edit.name,
:url => { :action => :save_editable, :id => @edit.id },
:rows => "5", :cols => "5")
%>
But i get only a normal clickeble text area and when i tried to save the
script nothing happened.
In the errorconsole of firefox i got tinyMCEaddMCEControl is not a
function.
I tried to use an older version of tinymce but no difference att all.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---