Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm not an ActiveAdmin expert. I need to have a number of customizations on some index pages. As recommended in the documentation, I'm trying to maintain AA pages build and then customize them by using Javascript. I succeeded by putting my own Javascript file under app/assets/javascripts, and then appending

//=require my_javascript_file

to app/assets/javascripts/active_admin.js

The problem is that this way the Javascript code gets loaded for ANY index page of any model. Which is the best way to insert Javascript code only for a specific model?

Thanks Thomas

like image 265
zeroquaranta Avatar asked Jun 02 '14 15:06

zeroquaranta


1 Answers

For me worked following:

form do |f|
  text_node javascript_include_tag "path_to/my_javascript_file"
...
like image 82
Alexandr Avatar answered Nov 09 '22 15:11

Alexandr