diff --git a/app/javascript/application.js b/app/javascript/application.js index 497ca7c0fd..ea2986aa6a 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -5,10 +5,16 @@ * all the interactions. */ import jQuery from 'jquery' +import 'admin-lte' +import "@oddcamp/cocoon-vanilla-js"; +import { Turbo } from "@hotwired/turbo-rails" + window.jQuery = jQuery window.$ = jQuery -import 'admin-lte' -import "@oddcamp/cocoon-vanilla-js"; +// Disable turbo by default to avoid issues with turbolinks +Turbo.session.drive = false console.log("Hello from importmap-rails!") + + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 718a97a450..2c222b8f50 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,7 +6,7 @@ <%= content_for?(:title) ? yield(:title) : default_title_content %> <%= csrf_meta_tags %> - <%= javascript_include_tag 'application' %> + <%# javascript_include_tag 'application' %> <%= stylesheet_link_tag 'application', media: 'all' %> <%= raw fullstory_script(current_user: current_user) if Rails.env.production? %> <%# javascript_pack_tag 'application' %> diff --git a/config/importmap.rb b/config/importmap.rb index 4b2b1bd592..aa7093d5a2 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,6 +1,9 @@ # Pin npm packages by running ./bin/importmap pin "application", preload: true +pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true +pin "@hotwired/stimulus", to: "https://ga.jspm.io/npm:@hotwired/stimulus@3.1.0/dist/stimulus.js" +pin_all_from "app/javascript/controllers", under: "controllers" pin "admin-lte", to: "https://ga.jspm.io/npm:admin-lte@3.2.0/dist/js/adminlte.min.js" pin "jquery", to: "https://ga.jspm.io/npm:jquery@3.6.1/dist/jquery.js", preload: true pin "@oddcamp/cocoon-vanilla-js", to: "https://ga.jspm.io/npm:@oddcamp/cocoon-vanilla-js@1.1.3/index.js"