turbolinks

javascript_include_tag throws unsupported method

余生长醉 提交于 2019-11-27 07:07:34
问题 I recently created a new project with Rails 4.2.0 and created a controller called Land for the landing page. So, I ran into this error upon visting http://localhost:3000/land/home : Started GET "/" for ::1 at 2015-02-27 15:56:23 -0600 Processing by LandController#home as HTML Rendered land/home.html.erb within layouts/application (0.0ms) Completed 500 Internal Server Error in 5526ms ActionView::Template::Error (TypeError: Object doesn't support this property or method (in C:/Ruby21-x64/lib

Using angularjs with turbolinks

主宰稳场 提交于 2019-11-27 05:57:48
I am trying to use Angularjs framework in my app with turbolinks. After page change it do not initialize new eventlisteners. Is it any way to make it work? Thanks in advance! AngularJS vs. Turbolinks Turbolinks as well as AnguluarJS can both be used to make a web application respond faster, in the sense that in response to a user interaction something happens on the web page without reloading and rerendering the whole page. They differ in the following regard: AngularJS helps you to build a rich client-side application , where you write a lot of JavaScript code that runs on the client machine.

Rails 4 Turbolinks make form submit multiple times

本秂侑毒 提交于 2019-11-27 03:35:25
问题 I use some code working nicely on Rails 3 but not on Rails 4, I guess it is caused by Turbolinks but I don't know much about it, can't dig more deep to solve my problem, here is the code: view: a/v/m/_new_comment.slim .new-comment - if current_user = render "editor_toolbar" = form_for(Comment.new, :remote => true, :url => mission_comments_path(@mission)) do |f| = f.text_area :content, :class => "span10", :rows => "4", :tabindex => "1" #preview.hidden = "Loading..." = f.submit t("missions

Rails 4 turbolinks with Google Analytics

若如初见. 提交于 2019-11-27 00:14:33
问题 I'm wondering what is the best way to implement Google Analytics tracking code along with the turbo linking in Rails 4. Will the normal snippet work? I've also seen a gems for this but I'm not sure what it does. 回答1: I think a better idea is to use the new Universal Analytics (from analytics.js file). Universal Analytics Solution (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s

Rails 5: how to use $(document).ready() with turbo-links

寵の児 提交于 2019-11-26 17:34:35
Turbolinks prevents normal $(document).ready() events from firing on all page visits besides the initial load, as discussed here and here . None of the solutions in the linked answers work with Rails 5, though. How can I run code on each page visit like in prior versions? Rather than listen to the ready event, you need to hook in to an event fired by Turbolinks for every page visit. Unfortunately, Turbolinks 5 (which is the version that appears in Rails 5) has been re-written, and does not use the same event names as in previous versions of Turbolinks, causing the answers mentioned to fail.

Using angularjs with turbolinks

夙愿已清 提交于 2019-11-26 12:49:45
问题 I am trying to use Angularjs framework in my app with turbolinks. After page change it do not initialize new eventlisteners. Is it any way to make it work? Thanks in advance! 回答1: AngularJS vs. Turbolinks Turbolinks as well as AnguluarJS can both be used to make a web application respond faster, in the sense that in response to a user interaction something happens on the web page without reloading and rerendering the whole page. They differ in the following regard: AngularJS helps you to

Using turbolinks in a Rails link_to

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 10:43:45
问题 Just wondering whether there\'s a way to use turbolinks directly in a rails link_to helper, a quick bit of googling didn\'t uncover anything of note, here\'s the type of thing I\'ve tried to no avail. <%= link_to \'Giraffe\', giraffe_path(@giraffe), :data-no-turbolink => \'true\' %> <%= link_to \'Giraffe\', giraffe_path(@giraffe), :data { :no-turbolink => \'true\'} %> I know you can do it in regular links like this <a data-no-turbolink=\'true\' href=\"/giraffe-130\">Giraffe</a> Right now I\'m

Rails 5: how to use $(document).ready() with turbo-links

余生颓废 提交于 2019-11-26 04:45:10
问题 Turbolinks prevents normal $(document).ready() events from firing on all page visits besides the initial load, as discussed here and here. None of the solutions in the linked answers work with Rails 5, though. How can I run code on each page visit like in prior versions? 回答1: Rather than listen to the ready event, you need to hook in to an event fired by Turbolinks for every page visit. Unfortunately, Turbolinks 5 (which is the version that appears in Rails 5) has been re-written, and does

Rails 4 turbo-link prevents jQuery scripts from working

心不动则不痛 提交于 2019-11-26 01:16:21
问题 I\'m building a Rails 4 app and I have a few scattered js files that I\'m trying to include \"the rails way\". I moved jquery plugins into the /vendor/assets/javascripts and I updated the manifest (application.js) to require them. When I load the pages locally I see that they appear correctly. However, I\'m getting inconsistent behavior from one of the scripts that\'s compiled. I have a controller-specific js file called projects.js which is referenced in the application.js via the use of

Rails ExecJS::ProgramError in Pages#home?

回眸只為那壹抹淺笑 提交于 2019-11-26 00:37:04
问题 Starting a new app, when I create a controller page home and try to go to local host:3000/pages/home, I get the following error: Showing c:/Users/Doesha/desktop/pinplug/app/views/layouts/application.html.erb where line #6 raised: TypeError: Object doesn\'t support this property or method (in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee) application.html.erb file: <!DOCTYPE html> <html> <head> <title>Pinplug</title> <%=