diff --git a/Gemfile b/Gemfile index b4752c745..a2bed131f 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,8 @@ gem 'rack-cors', '2.0.0', require: 'rack/cors' gem 'rails', '~> 7.1' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', require: false +# Turbo for SPA-like page acceleration +gem 'turbo-rails' ##-- rails application helper gems --## gem 'acts-as-taggable-on' diff --git a/Gemfile.lock b/Gemfile.lock index d9908f5e1..a46b42a9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -815,6 +815,9 @@ GEM i18n timeout (0.4.3) trailblazer-option (0.1.2) + turbo-rails (2.0.13) + actionpack (>= 7.1.0) + railties (>= 7.1.0) twilio-ruby (5.77.0) faraday (>= 0.9, < 3.0) jwt (>= 1.5, < 3.0) @@ -1004,6 +1007,7 @@ DEPENDENCIES telephone_number test-prof time_diff + turbo-rails twilio-ruby (~> 5.66) twitty (~> 0.1.5) tzinfo-data diff --git a/app/javascript/entrypoints/portal.js b/app/javascript/entrypoints/portal.js index 42493615d..a1b58e390 100644 --- a/app/javascript/entrypoints/portal.js +++ b/app/javascript/entrypoints/portal.js @@ -1,9 +1,9 @@ import Rails from '@rails/ujs'; -import Turbolinks from 'turbolinks'; +import { Turbo } from '@hotwired/turbo-rails'; import '../portal/application.scss'; import { InitializationHelpers } from '../portal/portalHelpers'; Rails.start(); -Turbolinks.start(); +Turbo.start(); -document.addEventListener('turbolinks:load', InitializationHelpers.onLoad); +document.addEventListener('turbo:load', InitializationHelpers.onLoad); diff --git a/app/javascript/portal/components/TableOfContents.vue b/app/javascript/portal/components/TableOfContents.vue index ec7ccd895..99e40fc86 100644 --- a/app/javascript/portal/components/TableOfContents.vue +++ b/app/javascript/portal/components/TableOfContents.vue @@ -110,7 +110,7 @@ export default {

diff --git a/app/javascript/portal/portalHelpers.js b/app/javascript/portal/portalHelpers.js index 5cced0fa4..3b41f7fc5 100644 --- a/app/javascript/portal/portalHelpers.js +++ b/app/javascript/portal/portalHelpers.js @@ -15,7 +15,7 @@ export const getHeadingsfromTheArticle = () => { const slug = slugifyWithCounter(element.innerText); element.id = slug; element.className = 'scroll-mt-24 heading'; - element.innerHTML += ``; + element.innerHTML += ``; rows.push({ slug, title: element.innerText, @@ -144,7 +144,7 @@ export const InitializationHelpers = { const a = document.createElement('a'); a.href = window.location.hash; - a['data-turbolinks'] = false; + a['data-turbo'] = false; a.click(); } }, diff --git a/app/views/layouts/portal.html.erb b/app/views/layouts/portal.html.erb index c4135fd37..cf144132d 100644 --- a/app/views/layouts/portal.html.erb +++ b/app/views/layouts/portal.html.erb @@ -18,7 +18,7 @@ By default, it renders: - + <%= vite_client_tag %> @@ -39,7 +39,7 @@ By default, it renders: <% else %> <%= @portal.page_title%> <% end %> - + <% if @portal.logo.present? %> <% end %> diff --git a/package.json b/package.json index 90b7708f6..01dfa43be 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@formkit/vue": "^1.6.7", "@hcaptcha/vue3-hcaptcha": "^1.3.0", "@highlightjs/vue-plugin": "^2.1.0", + "@hotwired/turbo-rails": "^8.0.13", "@iconify-json/material-symbols": "^1.2.10", "@june-so/analytics-next": "^2.0.0", "@lk77/vue3-color": "^3.0.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af7703fc6..3b0e3b606 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,6 +37,9 @@ importers: '@highlightjs/vue-plugin': specifier: ^2.1.0 version: 2.1.0(highlight.js@11.10.0)(vue@3.5.12(typescript@5.6.2)) + '@hotwired/turbo-rails': + specifier: ^8.0.13 + version: 8.0.13 '@iconify-json/material-symbols': specifier: ^1.2.10 version: 1.2.10 @@ -865,6 +868,13 @@ packages: '@histoire/vendors@0.17.17': resolution: {integrity: sha512-QZvmffdoJlLuYftPIkOU5Q2FPAdG2JjMuQ5jF7NmEl0n1XnmbMqtRkdYTZ4eF6CO1KLZ0Zyf6gBQvoT1uWNcjA==} + '@hotwired/turbo-rails@8.0.13': + resolution: {integrity: sha512-6SCnnOSzhtaJ0pNkAjncZxjtKsK3sP/vPEkCnTXBXSHkr+vF7DTZkOlwjhms1DbbQNTsjCsBoKvzSMbh/omSCQ==} + + '@hotwired/turbo@8.0.13': + resolution: {integrity: sha512-M7qXUqcGab6G5PKOiwhgbByTtrPgKPFCTMNQ52QhzUEXEqmp0/ApEguUesh/FPiUjrmFec+3lq98KsWnYY2C7g==} + engines: {node: '>= 14'} + '@humanwhocodes/config-array@0.11.14': resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} @@ -1036,6 +1046,9 @@ packages: '@rails/actioncable@6.1.3': resolution: {integrity: sha512-m02524MR9cTnUNfGz39Lkx9jVvuL0tle4O7YgvouJ7H83FILxzG1nQ5jw8pAjLAr9XQGu+P1sY4SKE3zyhCNjw==} + '@rails/actioncable@7.2.201': + resolution: {integrity: sha512-wsTdWoZ5EfG5k3t7ORdyQF0ZmDEgN4aVPCanHAiNEwCROqibSZMXXmCbH7IDJUVri4FOeAVwwbPINI7HVHPKBw==} + '@rails/ujs@7.1.400': resolution: {integrity: sha512-YwvXm3BR5tn+VCAKYGycLejMRVZE3Ionj5gFjEeGXCZnI0Rpi+7dKpmyu90kdUY7dRUFpHTdu9zZceEzFLl38w==} @@ -5723,6 +5736,13 @@ snapshots: '@histoire/vendors@0.17.17': {} + '@hotwired/turbo-rails@8.0.13': + dependencies: + '@hotwired/turbo': 8.0.13 + '@rails/actioncable': 7.2.201 + + '@hotwired/turbo@8.0.13': {} + '@humanwhocodes/config-array@0.11.14': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -5942,6 +5962,8 @@ snapshots: '@rails/actioncable@6.1.3': {} + '@rails/actioncable@7.2.201': {} + '@rails/ujs@7.1.400': {} '@rollup/rollup-android-arm-eabi@4.40.2':