diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a2477cbc..2597af194 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 20.x - uses: actions/cache@v2 with: @@ -71,7 +71,7 @@ jobs: - run: yarn install --frozen-lockfile - - run: bin/rails webpacker:compile + - run: bin/rails assets:precompile - name: Setup database env: diff --git a/.gitignore b/.gitignore index 5273f1166..64d9c21a4 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,6 @@ yarn-debug.log* .yardoc .env.local .env.test.local -gallery-dl \ No newline at end of file +gallery-dl +/app/assets/builds/* +!/app/assets/builds/.keep diff --git a/.tool-versions b/.tool-versions index 87c461b6d..065222465 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ ruby 3.1.4 -nodejs 14.17.0 +nodejs 20.6.1 yarn 1.22.4 diff --git a/Gemfile b/Gemfile index 77d9ef157..dada2c035 100644 --- a/Gemfile +++ b/Gemfile @@ -11,9 +11,6 @@ gem "pg", ">= 0.18", "< 2.0" # Use Puma as the app server gem "puma" -# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker -gem "webpacker", "5.4.4" - # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem "turbolinks", "~> 5" @@ -92,3 +89,7 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem # gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] + +gem "jsbundling-rails", "~> 1.2" + +gem "cssbundling-rails", "~> 1.3" diff --git a/Gemfile.lock b/Gemfile.lock index d670faf8e..7d44caeae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,6 +132,8 @@ GEM chronic (0.10.2) concurrent-ruby (1.2.2) crass (1.0.6) + cssbundling-rails (1.3.2) + railties (>= 6.0.0) date (3.3.3) devise (4.8.1) bcrypt (~> 3.0) @@ -219,6 +221,8 @@ GEM actionview (>= 5.0.0) activesupport (>= 5.0.0) jmespath (1.6.1) + jsbundling-rails (1.2.1) + railties (>= 6.0.0) jwt (2.3.0) kramdown (2.3.1) rexml @@ -281,7 +285,7 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.8) - nokogiri (1.15.3) + nokogiri (1.15.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth2 (1.4.9) @@ -324,11 +328,9 @@ GEM pundit (2.1.1) activesupport (>= 3.0.0) racc (1.7.1) - rack (2.2.7) + rack (2.2.8) rack-protection (2.2.0) rack - rack-proxy (0.7.6) - rack rack-test (2.1.0) rack (>= 1.3) rails (6.1.4.3) @@ -350,7 +352,7 @@ GEM actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.1.1) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) @@ -399,11 +401,10 @@ GEM scenic (1.6.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.11.0) + selenium-webdriver (4.12.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - semantic_range (3.0.0) sentry-raven (3.1.2) faraday (>= 1.0) singleton (0.1.1) @@ -423,9 +424,9 @@ GEM thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) - sprockets (4.0.2) + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) @@ -472,13 +473,8 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (5.4.4) - activesupport (>= 5.2) - rack-proxy (>= 0.6.1) - railties (>= 5.2) - semantic_range (>= 2.3.0) webrick (1.7.0) - websocket (1.2.9) + websocket (1.2.10) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -486,7 +482,7 @@ GEM nokogiri (~> 1.8) yard (0.9.27) webrick (~> 1.7.0) - zeitwerk (2.6.8) + zeitwerk (2.6.11) PLATFORMS ruby @@ -503,6 +499,7 @@ DEPENDENCIES byebug capybara (>= 2.15) chronic + cssbundling-rails (~> 1.3) devise dotenv-rails erb_lint (~> 0.1.1) @@ -510,6 +507,7 @@ DEPENDENCIES http image_processing (~> 1.12) jbuilder (~> 2.11) + jsbundling-rails (~> 1.2) lefthook letter_opener listen @@ -541,7 +539,6 @@ DEPENDENCIES turbolinks (~> 5) turbolinks_render web-console (>= 3.3.0) - webpacker (= 5.4.4) RUBY VERSION ruby 3.1.4p223 diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 000000000..421a5a25d --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,3 @@ +web: env RUBY_DEBUG_OPEN=true bin/rails server +js: yarn build-dev --watch +css: yarn build:css --watch diff --git a/app/javascript/images/.keep b/app/assets/builds/.keep similarity index 100% rename from app/javascript/images/.keep rename to app/assets/builds/.keep diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 000000000..fba68a609 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,2 @@ +//= link_tree ../images +//= link_tree ../builds \ No newline at end of file diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/javascript/images/calendar.png b/app/assets/images/calendar.png similarity index 100% rename from app/javascript/images/calendar.png rename to app/assets/images/calendar.png diff --git a/app/javascript/images/checklist.png b/app/assets/images/checklist.png similarity index 100% rename from app/javascript/images/checklist.png rename to app/assets/images/checklist.png diff --git a/app/javascript/images/donation.png b/app/assets/images/donation.png similarity index 100% rename from app/javascript/images/donation.png rename to app/assets/images/donation.png diff --git a/app/javascript/images/github-logo.png b/app/assets/images/github-logo.png similarity index 100% rename from app/javascript/images/github-logo.png rename to app/assets/images/github-logo.png diff --git a/app/javascript/images/items.png b/app/assets/images/items.png similarity index 100% rename from app/javascript/images/items.png rename to app/assets/images/items.png diff --git a/app/javascript/images/logo.jpg b/app/assets/images/logo.jpg similarity index 100% rename from app/javascript/images/logo.jpg rename to app/assets/images/logo.jpg diff --git a/app/javascript/images/logo.png b/app/assets/images/logo.png similarity index 100% rename from app/javascript/images/logo.png rename to app/assets/images/logo.png diff --git a/app/javascript/images/logo_small.png b/app/assets/images/logo_small.png similarity index 100% rename from app/javascript/images/logo_small.png rename to app/assets/images/logo_small.png diff --git a/app/javascript/images/ruby-for-good-logo.png b/app/assets/images/ruby-for-good-logo.png similarity index 100% rename from app/javascript/images/ruby-for-good-logo.png rename to app/assets/images/ruby-for-good-logo.png diff --git a/app/javascript/images/team.png b/app/assets/images/team.png similarity index 100% rename from app/javascript/images/team.png rename to app/assets/images/team.png diff --git a/app/javascript/stylesheets/account.scss b/app/assets/stylesheets/account.scss similarity index 100% rename from app/javascript/stylesheets/account.scss rename to app/assets/stylesheets/account.scss diff --git a/app/javascript/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss similarity index 100% rename from app/javascript/stylesheets/admin.scss rename to app/assets/stylesheets/admin.scss diff --git a/app/assets/stylesheets/application.sass.scss b/app/assets/stylesheets/application.sass.scss new file mode 100644 index 000000000..535cf0d79 --- /dev/null +++ b/app/assets/stylesheets/application.sass.scss @@ -0,0 +1,4 @@ +@import './styles.scss'; +@import "awesomplete/awesomplete"; +@import "selectize/dist/css/selectize.default"; +@import './overrides.scss'; \ No newline at end of file diff --git a/app/javascript/stylesheets/globals.scss b/app/assets/stylesheets/globals.scss similarity index 100% rename from app/javascript/stylesheets/globals.scss rename to app/assets/stylesheets/globals.scss diff --git a/app/javascript/stylesheets/helpers/layouts_helper.scss b/app/assets/stylesheets/helpers/layouts_helper.scss similarity index 100% rename from app/javascript/stylesheets/helpers/layouts_helper.scss rename to app/assets/stylesheets/helpers/layouts_helper.scss diff --git a/app/javascript/stylesheets/homepage.scss b/app/assets/stylesheets/homepage.scss similarity index 100% rename from app/javascript/stylesheets/homepage.scss rename to app/assets/stylesheets/homepage.scss diff --git a/app/javascript/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss similarity index 100% rename from app/javascript/stylesheets/mixins.scss rename to app/assets/stylesheets/mixins.scss diff --git a/app/javascript/stylesheets/overrides.scss b/app/assets/stylesheets/overrides.scss similarity index 100% rename from app/javascript/stylesheets/overrides.scss rename to app/assets/stylesheets/overrides.scss diff --git a/app/javascript/stylesheets/partials/_admin_appointments.scss b/app/assets/stylesheets/partials/_admin_appointments.scss similarity index 100% rename from app/javascript/stylesheets/partials/_admin_appointments.scss rename to app/assets/stylesheets/partials/_admin_appointments.scss diff --git a/app/javascript/stylesheets/partials/_admin_memberships.scss b/app/assets/stylesheets/partials/_admin_memberships.scss similarity index 100% rename from app/javascript/stylesheets/partials/_admin_memberships.scss rename to app/assets/stylesheets/partials/_admin_memberships.scss diff --git a/app/javascript/stylesheets/partials/_appointment_form.scss b/app/assets/stylesheets/partials/_appointment_form.scss similarity index 100% rename from app/javascript/stylesheets/partials/_appointment_form.scss rename to app/assets/stylesheets/partials/_appointment_form.scss diff --git a/app/javascript/stylesheets/partials/_appointments.scss b/app/assets/stylesheets/partials/_appointments.scss similarity index 100% rename from app/javascript/stylesheets/partials/_appointments.scss rename to app/assets/stylesheets/partials/_appointments.scss diff --git a/app/javascript/stylesheets/partials/_index.scss b/app/assets/stylesheets/partials/_index.scss similarity index 100% rename from app/javascript/stylesheets/partials/_index.scss rename to app/assets/stylesheets/partials/_index.scss diff --git a/app/javascript/stylesheets/partials/_item_header.scss b/app/assets/stylesheets/partials/_item_header.scss similarity index 100% rename from app/javascript/stylesheets/partials/_item_header.scss rename to app/assets/stylesheets/partials/_item_header.scss diff --git a/app/javascript/stylesheets/partials/_items_index.scss b/app/assets/stylesheets/partials/_items_index.scss similarity index 100% rename from app/javascript/stylesheets/partials/_items_index.scss rename to app/assets/stylesheets/partials/_items_index.scss diff --git a/app/javascript/stylesheets/partials/_users_password_new.scss b/app/assets/stylesheets/partials/_users_password_new.scss similarity index 100% rename from app/javascript/stylesheets/partials/_users_password_new.scss rename to app/assets/stylesheets/partials/_users_password_new.scss diff --git a/app/javascript/stylesheets/partials/_users_sign_in.scss b/app/assets/stylesheets/partials/_users_sign_in.scss similarity index 100% rename from app/javascript/stylesheets/partials/_users_sign_in.scss rename to app/assets/stylesheets/partials/_users_sign_in.scss diff --git a/app/javascript/stylesheets/public.scss b/app/assets/stylesheets/public.scss similarity index 100% rename from app/javascript/stylesheets/public.scss rename to app/assets/stylesheets/public.scss diff --git a/app/javascript/stylesheets/application.scss b/app/assets/stylesheets/styles.scss similarity index 99% rename from app/javascript/stylesheets/application.scss rename to app/assets/stylesheets/styles.scss index c02492838..8f7b581d9 100644 --- a/app/javascript/stylesheets/application.scss +++ b/app/assets/stylesheets/styles.scss @@ -3,7 +3,7 @@ @import 'spectre.css/src/spectre'; @import 'spectre.css/src/spectre-icons'; @import 'spectre.css/src/spectre-exp'; -@import 'trix/dist/trix.css'; +@import 'trix/dist/trix'; @import 'spectre.css/src/mixins/_shadow'; @import './partials/index'; diff --git a/app/javascript/stylesheets/volunteer.scss b/app/assets/stylesheets/volunteer.scss similarity index 100% rename from app/javascript/stylesheets/volunteer.scss rename to app/assets/stylesheets/volunteer.scss diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a327df923..352a6edf7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -18,7 +18,7 @@ def logo(library: current_library, small: false, classes: "") if library.image.attached? image_tag url_for(library.image.variant(resize_to_limit: [100, 89])), class: classes else - image_pack_tag "logo#{small ? "_small" : nil}.png", class: classes + image_tag "logo#{small ? "_small" : nil}.png", class: classes end end diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 000000000..e68546f92 --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,35 @@ +import Rails from "@rails/ujs" +Rails.start() + +import Turbolinks from "turbolinks" +Turbolinks.start() + +import * as ActiveStorage from "@rails/activestorage" +ActiveStorage.start() + +import "./controllers" + +import "trix" +import "@rails/actiontext" + +import feather from "feather-icons/dist/feather" +document.addEventListener("turbolinks:load", function() { + feather.replace({ + width: 20, + height: 20, + class: "feather-icon", + }); +}) + +import scrollIntoView from 'smooth-scroll-into-view-if-needed'; + +Turbolinks.ScrollManager.prototype.scrollToElement = function(element) { + let classes = element.classList; + if (classes.contains("highlightable")) { + classes.add("highlight"); + } + scrollIntoView(element, { + behavior: 'smooth', + scrollMode: 'if-needed', + }); +} \ No newline at end of file diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js deleted file mode 100644 index 28fdb1375..000000000 --- a/app/javascript/controllers/hello_controller.js +++ /dev/null @@ -1,18 +0,0 @@ -// Visit The Stimulus Handbook for more details -// https://stimulusjs.org/handbook/introduction -// -// This example controller works with specially annotated HTML like: -// -//