turbolinks

turbolinks with masonry is not working [closed]

不问归期 提交于 2019-12-07 12:03:22
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . I have installed turbolink gem https://github.com/rails/turbolinks in my rails app 3.2.8. I use this gem, masonry for show elements https://github.com

Google Tag Manager Preview does not display when navigating to pages with TurboLinks

雨燕双飞 提交于 2019-12-07 03:12:27
I don't think GTM is recording data correctly for my Rails app. When i use the preview feature, the GTM preview data in developer tools only shows on initial page loads, subsequent page loads (using turbolinks) do not show the preview data. How should I set up GTM with TurboLinks? I have set up my GTM in the header like this: <script> var dataLayer = []; (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js

Javascript DOM events before and after Turbolinks cache

荒凉一梦 提交于 2019-12-07 00:46:31
Here I have: $(document).on 'turbolinks:load', -> console.log "page has loaded!" $ -> $("button#show-hide").click (e) -> e.preventDefault() which makes my click event available only after Turbolinks caches page. I can do $(document).on 'turbolinks:before-visit which will make event available only before Turbolinks caches. How should I make event available at all times? I think the problem here is that you are binding to two events: turbolinks:load and $(document).ready() . Turbolinks does not discard event listeners on the document so you can safely bind click handlers to it and they will be

Turbolinks and Controller-specific assets

半世苍凉 提交于 2019-12-07 00:40:16
问题 I've modified application.html.erb to use controller specific assets: application.html.erb : <!DOCTYPE html> <html> <head> <title>My Application</title> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= stylesheet_link_tag params[:controller], 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= javascript_include_tag params[:controller], 'data-turbolinks-track' => true %> <%= csrf_meta

What are the pros and cons of Asset-Pipeline/Turbolinks from Rails 4 for a big application? [closed]

余生颓废 提交于 2019-12-06 19:47:13
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . We're working on a pretty big and wide application. The website will have a lot of different sections with some very different user

Rails turbolinks breaking pnotify

心已入冬 提交于 2019-12-06 08:51:20
In my rails application, I have it so that when you vote, subscribe or unsubscribe from a list, it will show a popup using pnotify. This works fine until the user navigates to a different page, and now it is no longer working. This only works when page is loaded or reloaded. I know this is because turbolinks in a rails 4 application but it seems to execute all my other javascript code apart from the pnotify. Additional info.. The subscribe/unsubscribe and vote buttons have the method post and are executed remotely which means I have a seperate file names subscribe.js.erb, unsubscribe.js.erb

Turbolinks causes a link with href=“#” to trigger page refresh

独自空忆成欢 提交于 2019-12-06 06:20:22
问题 I have a very simple link on my page. <a href="#">My link</a> . It causes a page refresh. when I remove "turbolinks", it no longer causes a refresh. I've used links with hash fragments all the time in the past. Unless I've missed something very fundamental for a long time, I don't understand how this can cause a refresh. It does not have any JS event handlers attached to it. Any ideas? It may not matter, but I'm using jQuery, Twitter-Bootstrap, and Ruby on Rails. Clues so far: When I remove

Making jQuery works with Turbolinks

两盒软妹~` 提交于 2019-12-06 04:57:46
问题 I have a Rails 4 app, which uses Turbolinks . My understanding is that Turbolinks breaks jQuery code, as Turbolinks does not load new page, but only get new elements. Therefore, navigating to new page may not trigger .ready , although it always triggers .page:load , and thus new jQuery code won't initialize. I have a lot of jQuery code, so I don't want to modify my jQuery code to be compatible with Turbolinks. Is it possible to add a javascript code to my application.js that overwrites .ready

Turbolinks wipes out jQuery Mobile classes

假装没事ソ 提交于 2019-12-06 04:18:31
When I load a page in my rails app using Turbolinks, the DOM lacks the styles that are normally applied by jQuery Mobile . All of my JavaScript files run; the only problem is that I lose some of the styles I need for the JavaScript to actually work. For example, with Turbolinks, my header is: <a rel="external" href="/">MY SITE</a> Without, it is: <a rel="external" href="/" class="ui-link">MY SITE</a> I have confirmed that my JS files are running with Turbolinks. The trouble is that the expected jQuery Mobile classes don't exist. I'm not sure how to ensure the application of these classes when

Facebook SDK and rails 4 Turbolinks

岁酱吖の 提交于 2019-12-06 04:08:03
问题 I'm having a hard time trying to load fast the javascript Facebook SDK into my rails 4 application. Is there a good way to make it work correctly with turbolinks? if i add this code on my JS application assets. It's not working properly due to turbolinks: <div id="fb-root"></div> <script> window.fbAsyncInit = function() { // init the FB JS SDK FB.init({ appId : 'YOUR_APP_ID', // App ID from the app dashboard channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel file for x-domain comms