Skip to content
This repository has been archived by the owner on Jul 28, 2018. It is now read-only.

Issues with bootstrap plugins #78

Closed
caarlos0 opened this issue Oct 5, 2012 · 14 comments
Closed

Issues with bootstrap plugins #78

caarlos0 opened this issue Oct 5, 2012 · 14 comments

Comments

@caarlos0
Copy link

caarlos0 commented Oct 5, 2012

Hi, I looking for the best way to do that.. don't know if it could be fixed in turbolinks, in bootstrap, or anywhere...

But, I recently created a question in stackoverflow, and found that's the strange behavior is because the way of modal plugins of bootstrap were implemented.

Maybe it is a possible hack to do with that, to made it work...

@protocarl
Copy link

Pull request on bootstrap addressing this: twbs/bootstrap#5308

@caarlos0
Copy link
Author

caarlos0 commented Oct 7, 2012

thanks :)

@davydotcom
Copy link
Contributor

also, twitter-bootstrap-turbo gem "clone" of twitter-bootstrap-rails with turbo support is available in the interim. It uses a different solution to solving the problem, I actually prefer the pull-request solution over mine, but they both work.

@caarlos0
Copy link
Author

caarlos0 commented Oct 9, 2012

I see. currently I using twitter-bootstrap-turbo, and it's working well for me...

@ryw
Copy link
Contributor

ryw commented Oct 9, 2012

Note to future visitor using SCSS via https://github.com/anjlab/bootstrap-rails

I've applied @davydotcom's fix to that project in my fork: https://github.com/ryw/bootstrap-rails

@ryw
Copy link
Contributor

ryw commented Oct 9, 2012

@yury mentioned jquery.turbolinks as a possible fix to the issue as well.

I wonder if turbolinks should detect if app has jQuery, and if so, apply the following code, that wil help with this issue on a multitude of plugins, not just bootstrap.

From https://github.com/kossnocorp/jquery.turbolinks/blob/master/src/jquery.turbolinks.coffee

$ = require?('jquery') || window.jQuery

# List for store callbacks passed to `$` or `$.ready`
callbacks = []

# Call each callback in list
ready = ->
  callback() for callback in callbacks

# Bind `ready` to DOM ready event
$(ready)

# Store callbacks in list on `$` and `$.ready`
$.fn.ready = (callback) ->
  callbacks.push(callback)

# Bind `ready` to Tubolinks page change event
$(document).on('page:change', ready)

@davydotcom
Copy link
Contributor

That's pretty nice, however maybe out of scope here... One note is he binds to page:change where page:load would be more appropriate

Sent from my iPhone

On Oct 9, 2012, at 6:45 PM, Ryan Walker notifications@github.com wrote:

@yury mentioned jquery.turbolinks as a possible fix to the issue as well.

I wonder if turbolinks should detect if app has jquery, and if so, apply the following code from https://github.com/kossnocorp/jquery.turbolinks/blob/master/src/jquery.turbolinks.coffee

$ = require?('jquery') || window.jQuery

List for store callbacks passed to $ or $.ready

callbacks = []

Call each callback in list

ready = ->
callback() for callback in callbacks

Bind ready to DOM ready event

$(ready)

Store callbacks in list on $ and $.ready

$.fn.ready = (callback) ->
callbacks.push(callback)

Bind ready to Tubolinks page change event

$(document).on('page:change', ready)

Reply to this email directly or view it on GitHub.

@davydotcom
Copy link
Contributor

Man the more I look at jquery.turbolinks, the more I think this is awesome. @dhh, would potentially adding this as another asset in the gem be a good idea? Something like add this to your manifest for jquery support. etc.

@davydotcom
Copy link
Contributor

The ONLY, downside I see to kossonocopr jquery.turbolinks solution is that the order in which these js files are included become very important.

@caarlos0
Copy link
Author

👍 @davydotcom

With this solution, the turbolinks JS should always be the last included.

Also, I'm not a JS-ninja, but I do believe that it will generate a dependency of jQuery to turbolinks, huh?

@davydotcom
Copy link
Contributor

Not if its a seperate js file that you can require in your manifest optionally.

@caarlos0
Copy link
Author

seems legit.

@dhh
Copy link
Contributor

dhh commented Oct 10, 2012

Having it as a separate file sounds fine.

On Oct 10, 2012, at 1:46, David Estes notifications@github.com wrote:

Man the more I look at jquery.turbolinks, the more I think this is awesome. @dhh, would potentially adding this as another asset in the gem be a good idea? Something like add this to your manifest for jquery support. etc.


Reply to this email directly or view it on GitHub.

@caarlos0
Copy link
Author

👍

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

No branches or pull requests

5 participants