Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use tinyMCE with rails_admin?

I really like rails_admin, but my clients don't like CKEditor. Is this really the only option for WYSIWYG on this gem? Is there any way to use tinyMCE with rails_admin?

like image 593
tubbo Avatar asked Jul 19 '11 19:07

tubbo


1 Answers

after struggling to get CKEditor working properly in RailsAdmin (on Rails 3.1), I used tinymce: It works well and is done in minutes:

in your gemfile add:

gem 'tinymce-rails'

plus you inlcude a line in rails_admin.js.erb:

require_asset 'tinymce-jquery'

you may need to copy the whole file (rails_admin.js.erb) from the gem to /assets/javascripts/rails_admin/ before you do this.

finally, you will also need to add some jquery to the view files
app/views/rails_admin/main/edit.html.haml and app/views/rails_admin/main/new.html.haml

 :javascript 
   jQuery(function() { 
     jQuery('textarea').tinymce({ 
       theme: 'advanced' 
     }); 
   }); 

This will add the Wysiwyg to all text area fields.

like image 150
andistuder Avatar answered Sep 30 '22 02:09

andistuder