CSS include issue with Active Admin #11

alexcoplan opened this Issue Jul 29, 2012 · 3 comments

3 participants


I'm trying to include redactor with active admin - I added the gem, and my config file looks like this:

autoresize: true
lang: en
path: /assets/redactor-rails/
css: style.css

I also added the following line to my application.rb:

config.assets.precompile += ["redactor-rails/css/*"]

In my active admin form I have this line to create the textarea:

f.input :contents, input_html: { id: "redactor_content" }

My active admin js looks like this:

//= require active_admin/base
//= require redactor-rails

$(function() {

And I include the CSS in the active admin CSS file too:

// Active Admin CSS Styles
@import "active_admin/mixins";
@import "active_admin/base";
@import "redactor-rails";

In my edit form inside active admin (which is at http://localhost:3000/admin/snippets/1/edit), redactor does appear, but is strangely formatted, and for some reason, is trying to load this file: http://localhost:3000/admin/snippets/1/false/css/style.css - which of course 404s.

My redactor looks like this:

redactor screenshot

Do you know why it might be trying to load the file at that path? I assume that's what's causing it to look odd.


You don't need to do all the fancy stuff you have.

active_admin.js should look like:

//= require active_admin/base
//= require redactor-rails

Add this to the very top of active_admin.css.scss after removing your edits

 *= require redactor-rails

// Fix redactor-rails, 90% solution, the last 10% isn't worth it to me.
body.active_admin form.formtastic .redactor_box {
  margin-left: 20%;
  border: 1px solid #C9D0D6;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  width: 76%;

And add the editor by using the below in active_admin

f.input :contents, input_html:{class: 'redactor'}

I used the fix above and it appears to be working just fine.


Yep, fix above is working fine. Thanks @epochwolf.

@alexcoplan alexcoplan closed this Dec 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment