kreativgebiet/rich

Rich not being displayed in Rails Admin

Opened this issue · 6 comments

I use Rails Admin and I wanted to setup Rich with it. After bundle install I've run:

rails generate rich:install
rake db:migrate

I use Devise with model name Admin, so I modified /config/initializers/rich.rb:

config.authentication_method = :authenticate_admin!

Here is my model config in config/initializers/rails_admin.rb:

config.model Article do |a|

    edit do

      field :trailer_text, :rich_editor do
        config({
          :insert_many => true
        })
      end

      field :news_text, :rich_editor do
        config({
          :insert_many => true
        })
      end
    end
  end

Here is how it all looks like:
untitled

  • There are no javascript errors, just a message about fontawesome: "Resource interpreted as Font but transferred with MIME type application/font-woff: "http://localhost:3000/assets/fontawesome-webfont.woff". "
  • CKEditor and Rick Javascript is loaded
  • I've tried latest gem code, disabled all Chrome plugins and cleared cache

Any ideas how to debug this would be great!

[edit]: now it started to display something, link names without styling, but still no editor:
untitled2

Are both: Rich CSS and JavaScript files loaded?

Strange, sometimes JavaScript is not loaded at all, and sometimes it loads assets/rich/base.js?body=1 with body:

// Wire up Rich




;

I've inspected the inline JavaScript

var instance = CKEDITOR.instances['article_trailer_text'];
  if(instance) { CKEDITOR.remove(instance); }
  CKEDITOR.replace('article_trailer_text',....)

and run the code in console and this is what I got:

$ var a = CKEDITOR.instances['article_trailer_text']; => undefined
$ a = CKEDITOR.instances['article_trailer_text']; => a.editor {_: Object, elementMode: 1, element: d.element, name: "article_trailer_text", id: "cke_1"…}

var is somehow resposible? o.O

I met the same problem in Rails 4 with rails_admin
And here is what happened
2013-10-19 10 10 13

Was there any fix to this issue? I am getting exactly the same error in active admin too

I've merged this PR locally, and it helped for me.