diff --git a/Gemfile b/Gemfile index f2ba128f..1ce73dc3 100644 --- a/Gemfile +++ b/Gemfile @@ -14,38 +14,30 @@ gem 'pg' # Use Puma as the app server gem 'puma', '>= 5.5.2' -# Use SCSS for stylesheets -# gem 'sassc-rails', require: false # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # Use jquery as the JavaScript library gem 'jquery-rails' -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 3.0' +gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development - gem 'nokogiri', '>= 1.12.5' gem 'bootsnap', require: false gem 'haml' -# gem 'bootstrap' - gem 'friendly_id', '~> 5.1.0' gem 'newrelic_rpm' gem 'devise' + gem 'omniauth' gem 'twilio-ruby', '~> 4.11.1' @@ -56,6 +48,10 @@ gem 'jsbundling-rails' gem 'cssbundling-rails' +gem 'turbo-rails' + +gem 'stimulus-rails' + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri diff --git a/Gemfile.lock b/Gemfile.lock index 37045910..64a7f9e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -240,6 +240,7 @@ GEM rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) + redis (3.3.5) regexp_parser (2.2.0) responders (3.0.1) actionpack (>= 5.0) @@ -291,15 +292,17 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) + stimulus-rails (1.0.2) + railties (>= 6.0.0) strscan (3.0.1) temple (0.8.2) thor (1.2.1) tilt (2.0.10) timecop (0.9.4) timeout (0.2.0) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) + turbo-rails (1.0.1) + actionpack (>= 6.0.0) + railties (>= 6.0.0) twilio-ruby (4.11.1) builder (>= 2.1.2) jwt (~> 1.0) @@ -355,14 +358,16 @@ DEPENDENCIES puma (>= 5.5.2) rails (~> 7.0.1) rails-controller-testing + redis (~> 3.0) rspec-rails (~> 5.1.0) rubocop seed_dump simplecov spring sprockets-rails + stimulus-rails timecop - turbolinks (~> 5) + turbo-rails twilio-ruby (~> 4.11.1) tzinfo-data uglifier (>= 1.3.0) diff --git a/README.md b/README.md index 80cad29a..eaeeb9c1 100644 --- a/README.md +++ b/README.md @@ -74,28 +74,35 @@ Postgres ### Gems -| Name | Description | -| ------------------- | ---------------------------------- | -| puma | webserver | -| pg | postgres | -| sassc-rails | sass compiler | -| jquery-rails | legacy, allows use of jquery | -| jbuilder | legacy, build json objects | -| haml | legacy, write views in haml syntax | -| bootstrap | css framework | -| newrelic_rpm | legacy?, application monitoring | -| devise | authentication | -| omniauth | authentication | -| twilio-ruby | legacy, text messaging | -| activerecord-import | faster database imports | +| Name | Description | +| ------------------- | --------------------------------------------------- | +| puma | webserver | +| pg | postgres | +| jquery-rails | legacy, allows use of jquery | +| jbuilder | legacy, build json objects | +| haml | legacy, write views in haml syntax | +| bootstrap | css framework | +| newrelic_rpm | legacy?, application monitoring | +| devise | authentication | +| omniauth | authentication | +| twilio-ruby | legacy, text messaging | +| activerecord-import | faster database imports | +| stimulus | Create javascript controllers | +| turbo-rails | Manages what gets rendered on the frontend and when | +| redis | Caching system | +| jsbundling-rails | Bundle javascript asssets | +| cssbundling-rails | Bundle css assets | ### External APIs None yet. Hoping to integrate with Powerschool and Aspen for school administrative data. -### Javascript libraries +### Javascript -Esbuild is used as the javascript bundler. The javascript testing library is jest. +Esbuild is used as the javascript bundler. Scripts for esbuild are defined in package.json e.g. `yarn build`. This script will run if in development with `bin/dev`. +The javascript testing library is jest. Manually run test with `yarn test`. Javascript tests will also run with `bundle exec rake`. + +Stimulus is installed. Create a stimulus controller with `./bin/rails generate stimulus [controller]`. If you create a stimulus controller manually, you can add it to `index.js` with the command `stimulus:manifest:update`. ### css diff --git a/app/javascript/application.js b/app/javascript/application.js index 2bd5047e..3b1eddd3 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,19 +1,22 @@ // Entry point for the build script in your package.json -import Rails from "@rails/ujs" -import Turbolinks from "turbolinks" -import * as ActiveStorage from "@rails/activestorage" -// import "channels" +import Rails from "@rails/ujs"; +import * as ActiveStorage from "@rails/activestorage"; -Rails.start() -Turbolinks.start() -ActiveStorage.start() -import { initializeListenersForNavDropdowns, initializePopovers } from "./overview" -import { initializeListenersForHomeDropdowns } from "./home" -import { showEmptyDatasetModal } from "./modal" +Rails.start(); +ActiveStorage.start(); -document.addEventListener("turbolinks:load", () => { - initializeListenersForNavDropdowns() - initializeListenersForHomeDropdowns() - initializePopovers() - showEmptyDatasetModal() -}) +import { + initializeListenersForNavDropdowns, + initializePopovers, +} from "./overview"; +import { initializeListenersForHomeDropdowns } from "./home"; +import { showEmptyDatasetModal } from "./modal"; + +document.addEventListener("turbo:load", () => { + initializeListenersForNavDropdowns(); + initializeListenersForHomeDropdowns(); + initializePopovers(); + showEmptyDatasetModal(); +}); +import "@hotwired/turbo-rails"; +import "./controllers"; diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js new file mode 100644 index 00000000..1213e85c --- /dev/null +++ b/app/javascript/controllers/application.js @@ -0,0 +1,9 @@ +import { Application } from "@hotwired/stimulus" + +const application = Application.start() + +// Configure Stimulus development experience +application.debug = false +window.Stimulus = application + +export { application } diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js new file mode 100644 index 00000000..a2e968be --- /dev/null +++ b/app/javascript/controllers/index.js @@ -0,0 +1,5 @@ +// This file is auto-generated by ./bin/rails stimulus:manifest:update +// Run that command whenever you add a new controller or create them with +// ./bin/rails generate stimulus controllerName + +import { application } from "./application"; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1d497ffd..6368c128 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,8 +7,8 @@