{"action":"created","issue":{"url":"https://api.github.com/repos/waymondo/turboboost/issues/5","labels_url":"https://api.github.com/repos/waymondo/turboboost/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/waymondo/turboboost/issues/5/comments","events_url":"https://api.github.com/repos/waymondo/turboboost/issues/5/events","html_url":"https://github.com/waymondo/turboboost/issues/5","id":53978547,"number":5,"title":"page:fetch triggered with normal links but not turboboost form","user":{"login":"archonic","id":588846,"avatar_url":"https://avatars.githubusercontent.com/u/588846?v=3","gravatar_id":"","url":"https://api.github.com/users/archonic","html_url":"https://github.com/archonic","followers_url":"https://api.github.com/users/archonic/followers","following_url":"https://api.github.com/users/archonic/following{/other_user}","gists_url":"https://api.github.com/users/archonic/gists{/gist_id}","starred_url":"https://api.github.com/users/archonic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/archonic/subscriptions","organizations_url":"https://api.github.com/users/archonic/orgs","repos_url":"https://api.github.com/users/archonic/repos","events_url":"https://api.github.com/users/archonic/events{/privacy}","received_events_url":"https://api.github.com/users/archonic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-11T01:51:41Z","updated_at":"2015-01-18T20:11:31Z","closed_at":null,"body":"I've got some page transition animations which take advantage of turbolinks. Following normal links has the page:fetch event fire but it doesn't happen for my turboboosted form.\r\n\r\nThis is the JS that makes that happen:\r\n\r\n    document.addEventListener('page:change', function() {\r\n      document.getElementById('animate_wrapper').style.visibility = 'visible';\r\n      document.getElementById('animate_wrapper').className += ' animated fadeInRight';\r\n    });\r\n    document.addEventListener('page:fetch', function() {\r\n      document.getElementById('animate_wrapper').className += ' animated fadeOutLeft';\r\n    });\r\n\r\nThe form I turboboosted is a surveyor form which has some of its own JS going on. Is there a way I can confirm if a form is taking advantage of turboboost?"},"comment":{"url":"https://api.github.com/repos/waymondo/turboboost/issues/comments/70423562","html_url":"https://github.com/waymondo/turboboost/issues/5#issuecomment-70423562","issue_url":"https://api.github.com/repos/waymondo/turboboost/issues/5","id":70423562,"user":{"login":"waymondo","id":923418,"avatar_url":"https://avatars.githubusercontent.com/u/923418?v=3","gravatar_id":"","url":"https://api.github.com/users/waymondo","html_url":"https://github.com/waymondo","followers_url":"https://api.github.com/users/waymondo/followers","following_url":"https://api.github.com/users/waymondo/following{/other_user}","gists_url":"https://api.github.com/users/waymondo/gists{/gist_id}","starred_url":"https://api.github.com/users/waymondo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waymondo/subscriptions","organizations_url":"https://api.github.com/users/waymondo/orgs","repos_url":"https://api.github.com/users/waymondo/repos","events_url":"https://api.github.com/users/waymondo/events{/privacy}","received_events_url":"https://api.github.com/users/waymondo/received_events","type":"User","site_admin":false},"created_at":"2015-01-18T20:11:31Z","updated_at":"2015-01-18T20:11:31Z","body":"Just spent some time looking at this and its working for me as I'd expect it. Here's my example controller action:\r\n\r\n```\r\n  def create\r\n    @post = Post.new(post_params)\r\n\r\n    respond_to do |format|\r\n      if @post.save\r\n        format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n        format.json { render :show, status: :created, location: @post }\r\n      else\r\n        format.html { render :new }\r\n        format.json { render json: @post.errors, status: :unprocessable_entity }\r\n      end\r\n    end\r\n  end\r\n```\r\n\r\nform markup:\r\n\r\n```\r\n<%= form_for @post, turboboost: true do |f| %>\r\n  <div class=\"field\">\r\n    <%= f.label :title %><br>\r\n    <%= f.text_field :title %>\r\n  </div>\r\n  <div class=\"field\">\r\n    <%= f.label :body %><br>\r\n    <%= f.text_area :body %>\r\n  </div>\r\n  <div class=\"actions\">\r\n    <%= f.submit %>\r\n  </div>\r\n<% end %>\r\n```\r\n\r\nand coffeescript:\r\n\r\n```\r\ndocument.addEventListener 'page:fetch', ->\r\n  console.log('foo')\r\n```\r\n\r\nOn a successful post create, the redirect is hit and is processed with Turboboost. Turboboost calls `Turbolinks.visit` on the returned redirect URL, which calls [fetchReplacement](https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee#L52-L86) which fires `page:fetch`. `Turbolinks.visit` is also used for turboboost forms making GET requests, so all works there too.\r\n\r\nIf you aren't redirecting in your controller action with a POST request, then `page:fetch` isn't the right word to describe the event. You'd want to use `ajax:beforeSend` or `ajax:send` as I mentioned before."}}