-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
JS //= require bootstrap-sprockets breaks dropdowns #714
Comments
If you're using |
Well, somehow I need to include both of these following lines in production mode. Otherwise my dropdown menu won't work.
Btw, in development mode, I only need the I'm using: Ruby 2.1.1p76 |
|
I understand. But all the dropdown stop working if I include only
|
Im having the exact same problem as dkonayuki, including bootstrap-sprockets breaks dropdown menus |
I think this issue should be opened. There are some other people have this issue too in stackoverflow. And no solution so far. |
got same problem too |
@dkonayuki , have you tried to move them up and down? I removed //= require bootstrap-sprockets and I have this now: //= require jquery The only dropdown list I have is working fine.
|
This shouldn't be closed, I am having the issue too. Requiring it after jquery-ui fixed it for me - there is probably a conflicting variable name. I was using the following combobox: http://jqueryui.com/autocomplete/#combobox Here is a part of my code, in an attempt to reproduce it. I have omitted the CSS because it didn't affect the bug. application.js: //= require jquery-ui test.html: The dropdown and autocomplete still work, but the arrow for displaying the dropdown items disappears. Normal dropdowns (i.e. without calling $( '#element' ).combobox()) work as usual for me. The disappearing arrow issue was in both Chrome and Firefox (latest versions). |
@VelizarHristov select2 is a better combobox. |
I don't know if this helps, but I am using sass and had the following problem: but my production env wants this order (otherwise it wouldn't work): Confused and frustrated I kept digging around the .js and tweaked with rails versions and everything and comparing the against a site whose dropdown menu did work and all the .css and .js order looked OK. It turns out the problem was not in my .js but in my application.css. I am using SASS and was using application.css sprocket directives (//= require 'blah') but that turns out to not play well with SASS. (source: http://guides.rubyonrails.org/asset_pipeline.html). """ So my old application.css file had the following:
And so I moved it to application.css.sass and had the following instead (e.g. deleting all the sprockets //= directives): After that, I got my dev environment and my production environment to finally work (and I just kept my bootstrap after jquery). |
@ugghhh |
Removing the require for bootstrap-sprockets fixed the issue for me as well. Not sure what else it is going to affect, but for now I am leaving it out. |
@ugghhh This is my application.js //= require jquery In production doesn't work... Is there any alternative for drop down? |
It has to do with the order of the files. Bootstrap and Javascript / application.js //= require jquery //= require jquery.turbolinks //= require jquery_ujs //= require jquery-fileupload //= require jquery-ui //= require jquery-ui/datepicker //= require bootstrap-sprockets //= require bootstrap //= require bootstrap-select //= require bootstrap/alert //= require bootstrap/dropdown //= require turbolinks //= require_tree . Stylesheets / application.css.scss @import "jquery-ui"; @import "bootstrap-sprockets"; @import "bootstrap"; @import "custom"; @import "bootstrap-progressbar-3.3.0"; @import "bootstrap-progressbar-3.3.0.min"; @import "bootstrap-select"; @import "jquery.fileupload"; @import "jquery.fileupload-ui"; Also, if you add turbolinks, you'll need to do this in the View: I can't recall why that was needed... Best, Doug Harman From: 14tinchov [mailto:[email protected]] @ugghhh https://github.com/Ugghhh This is my application.js //= require jquery In production doesn't work... Is there any alternative for drop down? Reply to this email directly or view it on GitHub This email has been scanned by the Symantec Email Security.cloud This email has been scanned by the Symantec Email Security.cloud service. |
Do not require both bootstrap and bootstrap-sprockets in the JavaScript, you only need one of them |
Hi, sorry to bring this up again, what was the solution that works for this? I am having this issue now. The css ::after (down arrow) is not appearing on the navigation. application.scss
application.js
Thanks in advanced! |
That was a long time ago. My recollection is that the key is the order From: Vina Melody [mailto:[email protected]] Hi, sorry to bring this up again, what was the solution that works for The css ::after (down arrow) is not appearing on the navigation. application.scss *= require_tree . application.js //= require jquery $(document).ready(function(){ Thanks in advanced! Reply to this email directly or view it on GitHub This email has been scanned by the Symantec Email Security.cloud This email has been scanned by the Symantec Email Security.cloud service. |
Here's what I have in my latest proj application.scss
application.js
|
Hi @dougharman and @railsr thank you so much for giving me the clue! I play around with the order and just dumping all the js from template and managed to somehow make it work! Just in case any next fellow experiencing similar issue, I only fixed application.js which look like this now
Thanks a lot again! |
Not sure about your css / scss file - I don't have tree in mine. Application.js file should be in this order: //= require jquery From: Kirill [mailto:[email protected]] Here's what I have in my latest proj application.scss *= require_tree . application.js //= require jquery Reply to this email directly or view it on GitHub This email has been scanned by the Symantec Email Security.cloud This email has been scanned by the Symantec Email Security.cloud service. |
the require_tree in scss seems to be fine as of now ah yes thanks for your advice, moved //= require_tree . to the lowest line possible. |
I'm glad it worked. One further suggestion, this order for turbolinks Best, Doug From: Vina Melody [mailto:[email protected]] Hi @dougharman https://github.com/dougharman and @railsr Just in case any next fellow experiencing similar issue, I only fixed //= require jquery Thanks a lot again! Reply to this email directly or view it on GitHub This email has been scanned by the Symantec Email Security.cloud This email has been scanned by the Symantec Email Security.cloud service. |
Yup! |
I realize this thread is a bit old, but I had a the same issue with the dropdowns. The cause was that I had jquery js files that were being included by //=require_tree . Once I removed those files, it worked. |
I've isolated that the line
//= require bootstrap-sprockets
in the application.js manifest will prevent dropdowns in navbars from showing for ruby on rails.
Whether this line comes before or after the
//= require bootstrap
line doesn't seem to matter. Either way, it breaks dropdowns.Using
@import "bootstrap-sprockets";
for the CSS mainfest doesn't break dropdowns. Only including it in the js does.To reproduce, use:
ruby 2.0.0
rails 4.1.1
sass-rails (4.0.3)
bootstrap-sass (3.2.0.1)
autoprefixer-rails (2.2.0.20140804)
gem 'sprockets-rails', :require => 'sprockets/railtie'
The text was updated successfully, but these errors were encountered: