turbolinks

Is it possible to disable Turbolinks for specific jQuery Ajax calls to prevent the page from refreshing and scrolling?

亡梦爱人 提交于 2019-12-06 00:32:13
问题 I have a Rails 5 application and would very much like to use Turbolinks. Within the application there are several PATCH ajax calls that simply update the server with new data, but do not need to worry about updating the state of the page. Whenever these ajax requests return, Turbolinks refreshes the page and the browser scrolls to the top of the screen. This is not desirable behavior; it is much preferred that things just stay put where they are. Disabling Turbolinks eliminates the problem.

turbolinks with masonry is not working [closed]

好久不见. 提交于 2019-12-05 23:07:12
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/desandro/masonry . The problem is that masonry elements when I open a new page with turbolinks are not

Trouble using Foundation and Turbolinks with Rails 4

梦想与她 提交于 2019-12-05 14:20:30
I have a header with 2 buttons : Login and Sign up Like this . When I click on one of them, a window appear : window open . For this I use the "Reveal Modal" of foundation ( Reveal Modal ). My problem : If I click on link for open a new page of my website and try to open / close the Login or Sign up popup, the window is closed but this time the shadow stay ( like this ) and I need to press F5 for this works again. I use Rails 4 and foundation 5. File _header.html.erb (View Partial) <div class="large-12 columns header"> <div class="logo"> logo </div> <div class="infos"> <ul> <li><a href="#"

sometimes javascript run perfect and sometimes not in ruby on rails 4

谁说我不能喝 提交于 2019-12-05 13:29:06
I used datepicker in calendar it shows perfect but not shows the arrow button to change month. and also give error sometimes like this: ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_ef8c08_256x240.png") datepicker.js $(document).ready(function(){ $('[data-behaviour~=datepicker]').datepicker(); }); css link sorry for too long question and tell me if i miss something. Big thanks in advance Edit: I observed that when i delete the public/assets directory and then enter rake assets:precompile this time error is not showing but arrow still is not showing. It looks

Prevent Google maps JS executing multiple times caused by Rails Turbolinks

半城伤御伤魂 提交于 2019-12-05 12:28:51
问题 I'm currently working on Rails app that is getting the following error: You have included the Google Maps API multiple times on this page. This may cause unexpected errors. After a little research I discovered that Turbolinks was causing the problem. When the link_to is clicked all of the DOM elements created by Google maps are retained within the DOM. When a new page is rendered another set of Google Map DOM elements is added causing duplicates and the error. I could fix this very quickly by

Turbolinks and Controller-specific assets

こ雲淡風輕ζ 提交于 2019-12-05 03:01:11
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_tags %> </head> <body> ... other html template ... The problem is that, I have turbolinks installed. When

Why shouldn't javascript be placed in view if it is only used on specific pages?

本小妞迷上赌 提交于 2019-12-05 02:02:43
问题 In his answer Richard Peck writes: Unobtrusive JS Something else to consider (you've already done this), is that you really need to use unobtrusive javascript in your application. Unobtrusive JS basically means that you're able to abstract your "bindings" from your page to your Javascript files in the asset pipeline. There are several important reasons for this: Your JS can be loaded on any page you want (it's DRY) Your JS will reside in the "backend" of your app (won't pollute views) You'll

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

旧城冷巷雨未停 提交于 2019-12-05 01:11:56
We're working on a pretty big and wide application. The website will have a lot of different sections with some very different user interface requirements and behaviors. Looking into the future, Rails 4 separated the asset pipeline into a separated gem so we can choose to include it or not. The same thing might happen with turbolinks. The question I keep asking myself these days and can't find an answer is: should I use theses libraries in our project or not ? The main issues in my reflection is the fact that the all-in-one file strategy will probably not work and we'll have to use file

Unable to unbind event listener - trouble with turbolinks caching

空扰寡人 提交于 2019-12-04 16:17:58
I'm binding then unbinding the ready event listener to the document. $(document).bind("ready", readyEventHandler); function readyEventHandler() { // run some code $(document).unbind("ready"); } The code produces no errors and will work. However, my javascript is cached and duplicates the code so I'll end up with having this code run more than once if I go back and then forward a page in the browser. When this happens, the ready event listener is not called at all. Am I properly unbinding this event listener? I know the caching issue becomes problematic(it's own separate issue) but I just want

Turbolinks 5.0 and Facebook SDK

 ̄綄美尐妖づ 提交于 2019-12-04 15:48:36
问题 Last week I upgraded to Rails 5 which is using Turbolinks 5.0. I used the following script to load the Facebook like button with Turbolinks 3.0: fb_root = null fb_events_bound = false $ -> loadFacebookSDK() bindFacebookEvents() unless fb_events_bound bindFacebookEvents = -> $(document) .on('page:fetch', saveFacebookRoot) .on('page:change', restoreFacebookRoot) .on('page:load', -> FB?.XFBML.parse() ) fb_events_bound = true saveFacebookRoot = -> fb_root = $('#fb-root').detach()