diff --git a/.gitignore b/.gitignore index 2972874c..a8419239 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,4 @@ yarn-debug.log* /storage/* !/storage/.keep all_sorns.code-workspace +vendor/javascript diff --git a/Gemfile b/Gemfile index 1c90a46c..d7b133e8 100644 --- a/Gemfile +++ b/Gemfile @@ -3,12 +3,10 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '~> 3.2' -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 7.0.0' -# We need to use rails 6-1.stable to get around a problem with good_job: -# https://github.com/bensheldon/good_job/issues/1016#issuecomment-1644915406 -gem 'rails', github: "rails/rails", branch: '6-1-stable' -# gem 'rails', '~> 6.1', '>= 6.1.7.8' +gem 'importmap-rails', '~> 2.0' +gem 'turbo-rails' gem 'good_job', '~> 4.0' gem 'pg' gem 'httparty' @@ -27,8 +25,6 @@ gem 'csv' gem 'puma', '~> 6.4' # Use SCSS for stylesheets gem 'sass-rails', '~> 6.0' -# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker -gem 'webpacker', '~> 5.4', '>= 5.4.4' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.12' @@ -58,8 +54,6 @@ end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 3.40' - gem 'selenium-webdriver' - # Easy installation and use of web drivers to run system tests with browsers - gem 'webdrivers', '~> 5.3' + gem 'selenium-webdriver', '~> 4.22' gem 'launchy' end diff --git a/Gemfile.lock b/Gemfile.lock index be516a92..7b83afd0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,97 +1,73 @@ -GIT - remote: https://github.com/rails/rails.git - revision: 959037fa483f4fa65a06f61db9653381d51f073b - branch: 6-1-stable +GEM + remote: https://rubygems.org/ specs: - actioncable (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) + actioncable (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + actionmailbox (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (>= 2.7.1) - actionmailer (6.1.7.8) - actionpack (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activesupport (= 6.1.7.8) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.4) + actionpack (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7.8) - actionview (= 6.1.7.8) - activesupport (= 6.1.7.8) - racc - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.8.4) + actionview (= 7.0.8.4) + activesupport (= 7.0.8.4) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.8) - actionpack (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + actiontext (7.0.8.4) + actionpack (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.8) - activesupport (= 6.1.7.8) + actionview (7.0.8.4) + activesupport (= 7.0.8.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.8) - activesupport (= 6.1.7.8) + activejob (7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.3.6) - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) - activerecord (6.1.7.8) - activemodel (= 6.1.7.8) - activesupport (= 6.1.7.8) - activestorage (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activesupport (= 6.1.7.8) + activemodel (7.0.8.4) + activesupport (= 7.0.8.4) + activerecord (7.0.8.4) + activemodel (= 7.0.8.4) + activesupport (= 7.0.8.4) + activestorage (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activesupport (= 7.0.8.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.8) - base64 - bigdecimal + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) drb i18n (>= 1.6, < 2) minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - zeitwerk (~> 2.3) - rails (6.1.7.8) - actioncable (= 6.1.7.8) - actionmailbox (= 6.1.7.8) - actionmailer (= 6.1.7.8) - actionpack (= 6.1.7.8) - actiontext (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activemodel (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) - bundler (>= 1.15.0) - railties (= 6.1.7.8) - sprockets-rails (>= 2.0.0) - railties (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) - method_source - rake (>= 12.2) - thor (~> 1.0) - -GEM - remote: https://rubygems.org/ - specs: addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.2.0) @@ -151,6 +127,10 @@ GEM multi_xml (>= 0.5.2) i18n (1.14.5) concurrent-ruby (~> 1.0) + importmap-rails (2.0.1) + actionpack (>= 6.0.0) + activesupport (>= 6.0.0) + railties (>= 6.0.0) interception (0.5) jbuilder (2.12.0) actionview (>= 5.0.0) @@ -173,6 +153,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.0) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -226,10 +207,22 @@ GEM raabro (1.4.0) racc (1.8.0) rack (2.2.9) - rack-proxy (0.7.7) - rack rack-test (2.1.0) rack (>= 1.3) + rails (7.0.8.4) + actioncable (= 7.0.8.4) + actionmailbox (= 7.0.8.4) + actionmailer (= 7.0.8.4) + actionpack (= 7.0.8.4) + actiontext (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activemodel (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) + bundler (>= 1.15.0) + railties (= 7.0.8.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -237,6 +230,13 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) + railties (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) @@ -276,11 +276,12 @@ GEM scenic (1.8.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.10.0) + selenium-webdriver (4.22.0) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - semantic_range (3.0.0) spring (4.2.1) spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) @@ -296,6 +297,10 @@ GEM thor (1.3.1) tilt (2.3.0) timeout (0.4.1) + turbo-rails (2.0.5) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) web-console (4.2.1) @@ -303,16 +308,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (5.3.1) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0, < 4.11) - webpacker (5.4.4) - activesupport (>= 5.2) - rack-proxy (>= 0.6.1) - railties (>= 5.2) - semantic_range (>= 2.3.0) - websocket (1.2.10) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -335,6 +331,7 @@ DEPENDENCIES federal_register (~> 0.7) good_job (~> 4.0) httparty + importmap-rails (~> 2.0) jbuilder (~> 2.12) kaminari (~> 1.2) launchy @@ -346,18 +343,17 @@ DEPENDENCIES pry-rescue pry-stack_explorer puma (~> 6.4) - rails! + rails (~> 7.0.0) rexml rspec-rails (~> 6.1) sass-rails (~> 6.0) saxerator scenic (~> 1.8) - selenium-webdriver + selenium-webdriver (~> 4.22) spring spring-watcher-listen (~> 2.1.0) + turbo-rails web-console (>= 4.2.1) - webdrivers (~> 5.3) - webpacker (~> 5.4, >= 5.4.4) RUBY VERSION ruby 3.2.2p53 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 59181933..1269c4de 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,2 +1,7 @@ //= link_tree ../images //= link_directory ../stylesheets .css +//= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js +//= link beforeSearch.js +//= link list.js/dist/list.js +//= link string-natural-compare/natural-compare.js diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 00000000..893a1b9d --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,12 @@ +// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails +// import "@hotwired/turbo-rails" +// import 'jquery'; + +import Rails from "@rails/ujs"; +Rails.start(); + +window.dataLayer = window.dataLayer || []; +function gtag(){dataLayer.push(arguments);} +gtag('js', new Date()); + +gtag('config', 'G-QZ9W5STPKJ'); diff --git a/app/javascript/packs/beforeSearch.js b/app/javascript/beforeSearch.js similarity index 100% rename from app/javascript/packs/beforeSearch.js rename to app/javascript/beforeSearch.js diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js deleted file mode 100644 index fa4fb4dc..00000000 --- a/app/javascript/packs/application.js +++ /dev/null @@ -1,22 +0,0 @@ -// This file is automatically compiled by Webpack, along with any other files -// present in this directory. You're encouraged to place your actual application logic in -// a relevant structure within app/javascript and only use these pack files to reference -// that code so it'll be compiled. - -require("@rails/ujs").start() -require("jquery") - -window.dataLayer = window.dataLayer || []; -function gtag(){dataLayer.push(arguments);} -gtag('js', new Date()); - -gtag('config', 'G-QZ9W5STPKJ'); - - - -// Uncomment to copy all static images under ../images to the output folder and reference -// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) -// or the `imagePath` JavaScript helper below. -// -// const images = require.context('../images', true) -// const imagePath = (name) => images(name, true) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 731ae93a..28f846cf 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,8 +2,11 @@ <%= @title%>SORNS Dash + <%= javascript_importmap_tags %> <%= csrf_meta_tags %> <%= csp_meta_tag %> + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + @@ -15,7 +18,6 @@ <%= stylesheet_link_tag 'application', media: 'all' %> - <%= javascript_pack_tag 'application' %> <%= content_for :search %> diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 45819a2b..9ffc4bf4 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -1,5 +1,5 @@ <% content_for :search do %> - <%= javascript_pack_tag 'beforeSearch' %> + <%= javascript_include_tag 'beforeSearch', type: "module" %> <% end %>
@@ -12,7 +12,7 @@
- <%= form_with local: false, url: search_path, method: "GET", id: "search-form", class: (params[:search].present? ? '' : 'pre-search') do %> + <%= form_with data: {turbo: false}, local: false, url: search_path, method: "GET", id: "search-form", class: (params[:search].present? ? '' : 'pre-search') do %>