Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use turbo #77

Merged
merged 4 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "controllers"
import "@hotwired/turbo-rails"
2 changes: 1 addition & 1 deletion app/app/javascript/controllers/admin_list_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default class extends Controller {

const href = event.currentTarget.dataset.href

window.location.href = href
Turbo.visit(href)
}
}
2 changes: 2 additions & 0 deletions app/app/views/layouts/admin/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
= csp_meta_tag
= stylesheet_link_tag 'admin', 'data-turbo-track': 'reload'
= javascript_importmap_tags
%meta{ name: 'turbo-prefetch', content: 'true' }
%meta{ name: 'view-transition', content: 'same-origin' }
%body
- if logged_in?
.application
Expand Down
3 changes: 3 additions & 0 deletions app/app/views/layouts/media/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
= csp_meta_tag
%link{ rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/yakuhanjp.css' }
= stylesheet_link_tag 'media', 'data-turbo-track': 'reload'
= javascript_importmap_tags
%meta{ name: 'turbo-prefetch', content: 'true' }
%meta{ name: 'view-transition', content: 'same-origin' }
%body
.application
.application__header
Expand Down
1 change: 1 addition & 0 deletions app/config/importmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
pin '@hotwired/stimulus', to: 'stimulus.min.js', preload: true
pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js', preload: true
pin_all_from 'app/javascript/controllers', under: 'controllers'
pin '@hotwired/turbo-rails', to: 'turbo.min.js'