AdminLTE icon indicating copy to clipboard operation
AdminLTE copied to clipboard

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

Open jarrieta86 opened this issue 10 years ago • 4 comments

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.

jarrieta86 avatar Aug 02 '16 16:08 jarrieta86

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.

foguinhoperuca avatar Aug 10 '16 01:08 foguinhoperuca

@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 avatar Dec 20 '16 09:12 twnaing

@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

twnaing avatar Dec 20 '16 09:12 twnaing

Closing due to inactivity

almasaeed2010 avatar May 28 '18 09:05 almasaeed2010