修复ActiveAdmin样式表问题

时间:2013-07-19 17:22:53

标签: javascript css ruby-on-rails activeadmin ruby-on-rails-4

我已经设置了activeadmin,但我不得不将这些文件拉出来并将它们放入一个名为“admin”的assets / stylesheets和assets / javascripts子文件夹中,因为这些样式继承到我的主应用程序并导致各种各样的的问题。

我按照此处的说明操作:http://mrdanadams.com/2011/exclude-active-admin-js-css-rails 其中:

Create the folders app/assets/javascripts/admin and app/assets/stylesheets/admin and move the files active_admin.js and active_admin.css.scss into these folders, respectively.

In your app/assets/stylesheets/application.css.scss you will find the following near the top:

 *= require_self
 *= require_true .

Change this to:

 *= require_self
 *= require_directory .

Do the same for application.js.

The culprit is active_admin’s asset_registration.rb and application.rb:

def register_default_assets
register_stylesheet 'active_admin.css'
register_javascript 'active_admin.js'
end

To clear these and replace them with the new files, add the following to the bottom of config/initializers/active_admin.rb:

config.clear_stylesheets!
config.register_stylesheet 'admin/active_admin.css'

config.clear_javascripts!
config.register_javascript 'admin/active_admin.js'

我已按照这些说明操作,但现在我的管理员丢失了样式/ js功能,看起来我的应用仍然试图将这些文件拉进去。

寻求帮助让资产发挥作用,并使其远离我的主应用程序。谢谢!

0 个答案:

没有答案