turbolinks

Googletagmanager with Turbolinks

耗尽温柔 提交于 2019-12-18 06:29:05
问题 Can someone explain how should we properly integrate Googletagmanager with Turbolinks? On normal pages we just copy/paste this code immediatelly after after the opening tag. <!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-******" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(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],

Rails 4 TurboLinks and jQuery Dynamic Links Not Playing Nice

╄→尐↘猪︶ㄣ 提交于 2019-12-18 03:32:08
问题 I am developing an application in Rails 4.0 and I'm having an issue with turbolinks not playing nice with some jQuery code I have. I have a Quote model that has a related QuoteItems model. I am using accepts_nested_attributes_for and some jQuery to populate the line items form. When I click on a link bringing me to the new_quote_path, The dynamic link doesn't fire the javascript code. When I refresh the page, the form WORKS GREAT. I like turbolinks as it is super fast, but not sure how to get

How to disable Turbolinks for single page in a shared view?

送分小仙女□ 提交于 2019-12-13 18:07:09
问题 I have a Javascript, which should work on $(document).ready but it won't, because I also have to use turbolinks. Is there a way to disable it for this script? Or at least, is there a way to disable it for the view, I want my script to work on? Sadly, my Site has to have allways the same layout file, as it is important for the corporate-style. Ok, I found a way, how it should be done, but i don't know how to do it. In my application.html.erb, I have tp add <body <% if(######) %> data-no

Firing tags in GTM (Google Tag Manager) containers under turbolinks

感情迁移 提交于 2019-12-13 16:50:24
问题 Has anyone figured out a way to get a Google Tag Manager container to fire all its tags under Turbolinks? I'm running a rails 4.0 application (with Turbolinks) and have put the code below in a footer that I render in every page (inside the tags): <!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':

jQuery Autocomplete doesn't work in Rails 4

限于喜欢 提交于 2019-12-12 23:16:07
问题 I'm trying to integrate jQuery UI Autocomplete in my Rails 4.0 application like described in this Railscast: 102-AutoCompleteAssociationRevised. Unfortunately, the autocompletion doesn't work. I don't get any suggestions although the rendered HTML looks fine: <input id="plan_part_name" type="text" name="plan[part_name]" data-autocomplete-source="["foo","food","foobar"]"></input> I also deactivated Turbolinks, but nothing changed... In my Gemfile I included gem 'jquery-ui-rails' and my

How do I make this JS Turbolinks friendly?

◇◆丶佛笑我妖孽 提交于 2019-12-12 15:08:30
问题 This is my main.js file: jQuery(function($) { $('LI.tree-item-name').has('ul').click(function() { if ($(this).hasClass('opened')) { $(this).find('UL').slideUp(); $(this).removeClass('opened'); } else { $(this).find('UL').slideDown(); $(this).addClass('opened'); } return false; }); $('LI.tree-item-name li').click(function(e) { e.stopPropagation(); }) }); jQuery(window).load(function(){ jQuery('#video').removeClass('loading'); jQuery('#video .box').animate({'opacity' : '1'}); var $container =

Turbolinks: what is the Rails 4 way of showing progress for slow pages?

耗尽温柔 提交于 2019-12-12 10:36:05
问题 This question might sound similar to Rails turbolinks long request doesn't show page load. I've recently started new Rails 4 application, which uses Turbolinks library by default - it is awesome: makes the application feel faster/snappier, however I do have some pages that are slower than others. Unfortunately I can't find a good way to make a browser show the default loading indicator - just like it does when it loads "conventional" web pages. People recommend different JavaScript solutions,

Turbolinks prohibiting Javascript appended class for background images

放肆的年华 提交于 2019-12-11 17:49:00
问题 I am integrating a front end html theme with a Laravel app and I am running into an issue with turbolinks not allowing Javascript to append div classes. This is causing the background images to only be displayed on refresh. <div class="intro-banner" data-background-image="/storage/images/hero.jpg"> <div class="container"> custom.js /*----------------------------------------------------*/ /* Inline CSS replacement for backgrounds /*----------------------------------------------------*/

How to properly render a partial via AJAX with Turbolinks enabled on Rails?

 ̄綄美尐妖づ 提交于 2019-12-11 12:44:58
问题 I'm currently working on a Rails app that has to communicate with an external web API, update DB records from the result and asynchronously update the view. What I'm currently doing I have a list action where I show data directly from the DB consisting of a list of emails sent in a table with pagination. After the view is rendered I need to make an AJAX request to the application (on a different route) that makes the request to the external web API, updates the DB and then renders the partial

Page-specific ActionCable

喜你入骨 提交于 2019-12-11 11:13:09
问题 Curious what the best practice is for using ActionCable with Turbolinks, when you want to tie a channel with the page being viewed. The classic example, of course, if you had an article with comments -- how can you stream only those comments related to the article in view and then subscribe to a different channel when viewing a different article? I've played around with using turbolinks:loaded event on JQuery, but cant figure out what to link that to. Do I want to resubcribe every time? How