ruby on rails - ActiveAdmin - Custom Javascript only for specific resource, not for any page -


i'm not activeadmin expert. need have number of customizations on index pages. recommended in documentation, i'm trying maintain aa pages build , customize them using javascript. succeeded putting own javascript file under app/assets/javascripts, , appending

//=require my_javascript_file 

to app/assets/javascripts/active_admin.js

the problem way javascript code gets loaded index page of model. best way insert javascript code specific model?

thanks thomas

yes, expected require in active_admin.js. wrap page customizations in function invoke function if current url matches path of page want customize. in coffeescript/jquery looks like

order_form_init = -> ...  jquery order_form_init if window.location.pathname.match(/\/orders\/new/)? 

the same applies regardless of particular javascript tools using.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -