ColorlibHQ / AdminLTE

AdminLTE - Free admin dashboard template based on Bootstrap 5
https://adminlte.io
MIT License
43.75k stars 18.17k forks source link

AdminLTE doesn't work well with Turbolinks in Ruby on Rails 4 #1148

Closed jarrieta86 closed 6 years ago

jarrieta86 commented 7 years ago

Hi,

I am having problems making AdminLTE work in Rails 4 with the Turbolinks feature. (footer doesn't fix at the bottom, sidebar multilevel menu doesn't stay open, etc.) It would be great if you can do the proper changes to make AdminLTE compatible.

foguinhoperuca commented 7 years ago

Hi!

I got the same problem. The workarround is move everything inside public/. Isn't so good but you can work with RoR and AdminLTE.

For footer problem I learned that I can't put the js links in the end of application.html.erb (I don't know why but the js code was loading 2x). Instead, put it after the css tags in header.

+1 for integration with rails asset pipeline.

twnaing commented 7 years ago

@foguinhoperuca, if you read this turbolinks detail

Scripts in head

You may be putting your scripts at the end of the <body> tag. If you're using Turbolinks, move them back to <head>. The reason for this is that Turbolinks works by swapping out the <body> when changing pages, and doing so will re-execute all your third-party scripts (imagine jQuery being re-evaluated), which may not be what you want.

https://coderwall.com/p/ypzfdw/faster-page-loads-with-turbolinks

twnaing commented 7 years ago

@jarrieta86 what is your setup looks like?

Generally, make sure you correctly setup turbolinks. This one is a good read https://coderwall.com/p/ypzfdw/faster-page-loads-with-turbolinks

//= require jquery
//= require jquery.turbolinks

//= require others

//= require turbolinks

And also read some of the existing answers.

How to remember the toggle state of the sidebar menu (CodeIgniter) https://github.com/almasaeed2010/AdminLTE/issues/1240

JQuery Turbolinks Issue using AdminLTE Theme https://github.com/almasaeed2010/AdminLTE/issues/563

almasaeed2010 commented 6 years ago

Closing due to inactivity