Giter Site home page Giter Site logo

Comments (14)

protocarl avatar protocarl commented on August 16, 2024

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

from turbolinks-classic.

caarlos0 avatar caarlos0 commented on August 16, 2024

thanks :)

from turbolinks-classic.

davydotcom avatar davydotcom commented on August 16, 2024

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.

from turbolinks-classic.

caarlos0 avatar caarlos0 commented on August 16, 2024

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

from turbolinks-classic.

ryw avatar ryw commented on August 16, 2024

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

from turbolinks-classic.

ryw avatar ryw commented on August 16, 2024

@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)

from turbolinks-classic.

davydotcom avatar davydotcom commented on August 16, 2024

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 [email protected] 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.

from turbolinks-classic.

davydotcom avatar davydotcom commented on August 16, 2024

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.

from turbolinks-classic.

davydotcom avatar davydotcom commented on August 16, 2024

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

from turbolinks-classic.

caarlos0 avatar caarlos0 commented on August 16, 2024

👍 @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?

from turbolinks-classic.

davydotcom avatar davydotcom commented on August 16, 2024

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

from turbolinks-classic.

caarlos0 avatar caarlos0 commented on August 16, 2024

seems legit.

from turbolinks-classic.

dhh avatar dhh commented on August 16, 2024

Having it as a separate file sounds fine.

On Oct 10, 2012, at 1:46, David Estes [email protected] 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.

from turbolinks-classic.

caarlos0 avatar caarlos0 commented on August 16, 2024

👍

from turbolinks-classic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.