Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdowns don't seem to be working. #1

Open
ghost opened this issue Feb 12, 2017 · 14 comments
Open

Dropdowns don't seem to be working. #1

ghost opened this issue Feb 12, 2017 · 14 comments

Comments

@ghost
Copy link

ghost commented Feb 12, 2017

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

@mwlang
Copy link
Owner

mwlang commented Feb 12, 2017

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
Copy link
Owner

mwlang commented Feb 13, 2017

@buffalods any luck?

@jayjlawrence
Copy link

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.

@mwlang
Copy link
Owner

mwlang commented Feb 19, 2017

@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 mwlang closed this as completed Feb 19, 2017
@mwlang
Copy link
Owner

mwlang commented Feb 19, 2017

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 mwlang reopened this Feb 19, 2017
@huanlv94
Copy link

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

@mwlang
Copy link
Owner

mwlang commented Mar 1, 2017

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 mwlang closed this as completed Mar 1, 2017
@kirillseva
Copy link

@mwlang it's back

@kirillseva
Copy link

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
Copy link

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

var CURRENT_URL = window.location.href.split('#')[0].split('?')[0],
$BODY = $('body'),
$MENU_TOGGLE = $('#menu_toggle'),
$SIDEBAR_MENU = $('#sidebar-menu'),
$SIDEBAR_FOOTER = $('.sidebar-footer'),
$LEFT_COL = $('.left_col'),
$RIGHT_COL = $('.right_col'),
$NAV_MENU = $('.nav_menu'),
$FOOTER = $('footer');

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

@hatjc-zz
Copy link

similar issue need help really stuck on this non working menu

@mwlang
Copy link
Owner

mwlang commented Mar 10, 2018

@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 mwlang reopened this Mar 10, 2018
@hatjc-zz
Copy link

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

@huanlv-starx
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants