sferik/rails_admin — pull request #1164 by rovermicrover (2012-05-26 18:23:03+00:00)
Title: Added the ability to do codemirror true on a text field and have a codem...

Sorry about the one before forgot to add a topic branch and rebase everything. Tested again with "bundle exec rake spec" and worked fine.

--------------

These commits should allow for something like this.

```ruby
field :css, :text do
codemirror true
end
```

requires
https://github.com/fixlr/codemirror-rails

The commits also add the following options for setting up ckeditor.

```ruby
#Use this if you want to point to a cloud instances of CKeditor
register_instance_option(:ckeditor_location) do
'/assets/ckeditor/ckeditor.js'
end

#Use this if you want to point to a cloud instances of the base CKeditor
register_instance_option(:ckeditor_base_location) do
'/assets/ckeditor/'
end
```

Then for Codemirror the options are

```ruby
# Codemirror is disabled by default and CKEditor takes presedence
register_instance_option(:codemirror) do
false
end

#Pass the theme and mode for Codemirror
register_instance_option(:codemirror_config) do
{
:mode => 'css',
:theme => 'night'
}
end

register_instance_option(:codemirror_assets) do
{
:mode => '/assets/codemirror/modes/css.js',
:theme => '/assets/codemirror/themes/night.css'
}
end

#Use this if you want to point to a cloud instances of CodeMirror
register_instance_option(:codemirror_js_location) do
'/assets/codemirror.js'
end

#Use this if you want to point to a cloud instances of CodeMirror
register_instance_option(:codemirror_css_location) do
'/assets/codemirror.css'
end
```

Some Notes:
I had to remove @import "bootstrap/code"; from imports.css.scss.erb because it was conflicting with the basic code mirror styling.

I have tested

```ruby
codemirror true
ckeditor true
```
Both still work with one or more instances.

I have though had a tough time testing the configs I added. I guess I must not be setting them correctly or something because I can't get them to be anything but the default.

Inspired by:
The following issue posted by https://github.com/kennyadsl
https://github.com/sferik/rails_admin/issues/871

Implementation via binding on a project I worked a little bit on with
https://github.com/nthj

I hope this helps!