活动管理员:包括Javascript [英] Active Admin: Including Javascript

查看:73
本文介绍了活动管理员:包括Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Gon( https://github.com/gazay/gon )添加到我的计算机中主动管理员

I want to add Gon ( https://github.com/gazay/gon ) to my activeadmin

但是我需要添加行

<%= include_gon %>

到布局的头部

但是我不知道怎么办?

推荐答案

添加到Mexxer的注释中.转到`config/initializers/active_admin.rb

To add to Mexxer's comment. Go to `config/initializers/active_admin.rb

在页面底部,您将找到以下内容:

At the bottom of the page, you'll find the following:

# == Register Stylesheets & Javascripts
#
# We recommend using the built in Active Admin layout and loading
# up your own stylesheets / javascripts to customize the look
# and feel.
#
# To load a stylesheet:
#   config.register_stylesheet 'my_stylesheet.css'
#
# To load a javascript file:
#   config.register_javascript 'my_javascript.js'

取消注释最后一行,并用您的文件替换my_javascript.js,就像这样...

Uncomment the last line and replace my_javascript.js with your file, like this...

# To load a javascript file:
config.register_javascript 'invoices.js'

该文件可以位于app/assets/javascripts/invoices.js

这篇关于活动管理员:包括Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆