Skip to content

Commit

Permalink
Merge pull request #77 from yamat47/use-turbo
Browse files Browse the repository at this point in the history
Use turbo
  • Loading branch information
yamat47 authored Aug 17, 2024
2 parents 60a8204 + 5d5adef commit f0ba206
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
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'

0 comments on commit f0ba206

Please sign in to comment.