railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.87k stars 2.25k forks source link

Rails 7 Sprockets: Add custom js using custom/ui.js is not working (but i.e. custom\theming.scss is) #3598

Closed gabrieletassoni closed 1 year ago

gabrieletassoni commented 1 year ago

Describe the bug In my engine I added a console.log("Running") to app/assets/javascripts/rails_admin/custom/ui.js as stated in the example on how to add custom js and css, but nothing is printed on the console, obviously, adding also a function doesn't make the function available in the views. Adding it to assets precompile has no effect. Strangely enough, the stylesheet in app/assets/stylesheets/rails_admin/custom/theming.scss is applied, without or without declaring it for precompilation. The rails app uses Sprockets assets pipeline and rails_admin has been configured to generate the initializer for sprockets.

Reproduction steps

  1. Create an engine which depends on rails_admin
  2. In a RoR app add it to the Gemfile, bundle and rails s

Expected behavior Javascript from the rails_admin/custom/ui.js must work as per the example.

Additional context

gabrieletassoni commented 1 year ago

Having restarted it all from scratch, without engines not ported to RA 3 fixed this, so, I need to fix those engines, closing this issue.