gentelella-rails icon indicating copy to clipboard operation
gentelella-rails copied to clipboard

Dropdowns don't seem to be working.

Open ghost opened this issue 8 years ago • 14 comments

I followed the instructions to the letter, but the dropdown menus don't work. Is there something I am missing?

ghost avatar Feb 12 '17 02:02 ghost

I didn't heavily test. Which specific page and dropdown menu are you looking at? Are you able to see it working from the demo app I published? https://github.com/mwlang/gentelella-rails-demo

mwlang avatar Feb 12 '17 03:02 mwlang

@buffalods any luck?

mwlang avatar Feb 13 '17 21:02 mwlang

I encountered the same issue. I just did a fresh install of both projects and got up and running nicely. The dropdowns don't work. It seem like they're not getting setup after document load.

Calling

  • $(".dropdown-toggle").dropdown()

makes them work.

I had no warnings. This is using Safari 10.0 and also Chrome Version 56.0.2924.87 (64-bit)

Other things are broken too (like modal windows). I forked the projects and am going to see if I can address this issue. I'd like to give the Gentelella admin UI for both an OSS as well as work project so I'm quite keen to make this work well.

jayjlawrence avatar Feb 18 '17 18:02 jayjlawrence

@jayjlawrence thanks for the detailed info. With that, I was able to quickly fix. I've pushed a new release 0.1.1 and the fix is on master branch as well.

mwlang avatar Feb 19 '17 15:02 mwlang

I think that the bootstrap init javascript isn't loading late enough in the chain. Reopening this one to look into also fixing modal windows, etc.

mwlang avatar Feb 19 '17 15:02 mwlang

I also encountered similar problems, how to solve it ?.

huanlv94 avatar Feb 21 '17 03:02 huanlv94

I found the root cause to this problem. Turns out I made a mistake including "bootstrap-sprockets" AND "bootstrap" in the gem's main coffee script file that pulls in all the various dependencies. Removing the "bootstrap-sprockets" line resolved dropdowns, modals, and other bootstrap JS dependent functionality.

Both this gem and the demo project are updated.

mwlang avatar Mar 01 '17 17:03 mwlang

@mwlang it's back

kirillseva avatar Feb 05 '18 17:02 kirillseva

gem version 0.1.11, confirmed that 'gentellela-custom' is the last piece of javascript to be loaded. When I copypaste the whole script into dev console functionality is restored. Looks like something is fishy with regards to how sprockets are bundling all this.

Also tried replacing document.ready(... with document.on('turbolinks:load', ... - still no luck. If you ever get around to looking at this issue please advice on what would be the best course of action to debug this.

kirillseva avatar Feb 05 '18 17:02 kirillseva

The problem turned out to be, as usual, caused by turbolinks and no longer existing JS globals.

https://github.com/mwlang/gentelella-rails/blob/8d74299fe0d7816bcbf0abd916cf60493560282d/lib/generators/gentelella/install/templates/gentelella-custom.js#L42-L50

The simplest solution is to just wrap the whole damned thing in $(document).on('turbolinks:load', function() {...});

kirillseva avatar Feb 05 '18 18:02 kirillseva

similar issue need help really stuck on this non working menu

hatjc-zz avatar Feb 27 '18 19:02 hatjc-zz

@kirillseva and @hatens Sorry for my non-responsiveness on this. I've been under a heavy workload for a while. from the sounds of it, it does sound like a turbo-link issue. It may not be a document-load/ready issue, but a rather firing the correct event against turbo-links when menus are clicked. I cannot rightly recall exactly the turbo-link mechanism for this off the top of my head, but wanted to offer this quick suggestion as it may be some time before I can circle back to this and review in-depth.

Also, if one of you would put up a non-working example project that demonstrates the broken feature, I can review a bit quicker!

mwlang avatar Mar 10 '18 16:03 mwlang

@mwlang this turbo link issue also affects the navigation? and what can be the measure to solve this temporarily before a solution is found?

hatjc-zz avatar Mar 10 '18 17:03 hatjc-zz

var CURRENT_URL = window.location.href.split('#')[0].split('?')[0] Why not: var CURRENT_URL = window.location.origin + window.location.pathname ?

huanlv-starx avatar May 09 '18 08:05 huanlv-starx