Closed quangtt-rks closed 9 years ago
+1
It's probably Turbolinks and the $(document).ready()
event not firing since subsequent full page loads aren't happening on <a>
clicks. Remove the turbolinks gem from your Rails app by removing the gem in Gemfile
, remove the 2 references in the head
in layouts/application.html.erb
and remove the reference to it in app/assets/javascripts/application.js
Alternatively, use https://github.com/chukcha-wtf/adminlte and you can keep using turbolinks!
Thanks bros! @velobuff 's answer is right. Thank you again!
its due to turbolinks Below is the code for fix.
$(document).ready(function() {
$.AdminLTE.layout.activate();
});
$(document).on('page:load', function() {
var o;
o = $.AdminLTE.options;
if (o.sidebarPushMenu) {
$.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
}
$.AdminLTE.layout.activate();
});
@velobuff thank you so much bro
When I click toggle sidebar for the first time after entered URL, it works like normally. But wherener I click an item on sidebar to access other pages, this button stop working. It just add a "#" to address bar like normal a tag with href="#". Thought some JS didn't loaded. Any ideas? Thanks in advance!
Vietnamese: Nút ẩn hiện sidebar bị lỗi khi điều hướng giữa các trang bằng menu trên sidebar, khi nhập url và gõ enter thì lại bình thường, không biết có phải do lỗi đoạn JS nào đó không?
Ruby: 2.1.2 Rails: 4.1.6 Gem: adminlte-rails 1.3.3 OS: Ubuntu 14.04 Browser: Google Chrome 38