turbolinks

Holder.js doesn't work with turbolinks

断了今生、忘了曾经 提交于 2019-12-24 17:02:24
问题 Holder.js doesn't work with turbolinks. I'm getting empty images. It works when i press Ctrl+R. How to get them work together? 回答1: Use this script to run holder.js between requests: $(document).bind 'page:change', -> Holder.run() 回答2: For Rails 5 I had to use this: document.addEventListener('turbolinks:load', function() { Holder.run() }); See https://stackoverflow.com/a/18770589/1845011 and https://github.com/turbolinks/turbolinks#installing-javascript-behavior 来源: https://stackoverflow.com

How to load CKEditor only on the page that needs it?

时间秒杀一切 提交于 2019-12-24 11:24:17
问题 I'm using CKEditor gem. It is only used on admin pages. I want to only use it on the pages that require it. I commented out the Sprocket directive in application.js // only load on required pages // require ckeditor/init And I add it to the form page at the top <%= javascript_include_tag 'ckeditor/init' %> However it only works sometimes. If I reload a page without it, and navigate to a page with it, then it loads the script, but fails to decorate the text box. There are no console errors. If

$(document).on 'ready page:load' - not working in ie10 correctly

拥有回忆 提交于 2019-12-24 03:37:21
问题 i am developing in rails. for jquery i use coffeescript. turbolinks are active. i have an issue and it gets me on my nerves. when i want to start my function (here called scripts) i use the following code: $(document).on 'ready page:load', => scripts() my script (div slider) is running when page is loaded, without any problems in all browsers. anyway, when i click on another page and then get back to the start, the javascript is not loading. this issue is actually only in ie10. i tried the

jQuery autocomplete not working with Turbolinks

醉酒当歌 提交于 2019-12-24 02:16:36
问题 I'm using Rails 4. This snippet from my shared.js.coffee works fine without turbolinks: jQuery -> $('input.autocomplete,textarea.autocomplete').each (index, item) => sel = $(item) sel.autocomplete source: sel.data('autocomplete-source') minLength: 1 But when I use Turbolinks, it only works on a page refresh. It does not work after navigating through the site. I've read Rails 4, Turbolinks, and Delegated Event Handling in jQuery, so I have some idea of what is going wrong, but I'm not yet sure

jQuery autocomplete not working with Turbolinks

感情迁移 提交于 2019-12-24 02:16:20
问题 I'm using Rails 4. This snippet from my shared.js.coffee works fine without turbolinks: jQuery -> $('input.autocomplete,textarea.autocomplete').each (index, item) => sel = $(item) sel.autocomplete source: sel.data('autocomplete-source') minLength: 1 But when I use Turbolinks, it only works on a page refresh. It does not work after navigating through the site. I've read Rails 4, Turbolinks, and Delegated Event Handling in jQuery, so I have some idea of what is going wrong, but I'm not yet sure

The stylesheet broken when loading different layout in different controllers

邮差的信 提交于 2019-12-23 04:11:49
问题 Hi I got a strange problem. When I clicked three pages shown in the following three images Step 1 controller welcome Step 2 other controllers Step 3, go back to the step1 view controller welcome The last image, when I back to controller welcome from the other controllers ,that is step 2 to step 3. The stylesheets were cached by the browser, The step 3's layout is differ to step1 layout. But they are the same page,How could it be, it seems the browser caches the css files ? I add two assets

JavaScript doesn't execute when navigating from page to page

若如初见. 提交于 2019-12-22 14:01:05
问题 I'm building my first Ruby on Rails application and I tried to create an animated navigation bar. I'm using jQuery and turbolink. This is my application.js (under /app/assets/javascripts ) $(document).ready(function(){ $("#nav").hover(function(){ $("#nav").animate({left:'10px'}); }, function(){ $("#nav").animate({left:'-220px'}); }); }); And on application.html.erb (under app/views/layouts ), I have <%= javascript_include_tag "application", "data-turbolinks-track" => true %> and my super

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

…衆ロ難τιáo~ 提交于 2019-12-22 08:31:02
问题 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

How to disable Turbolinks in a specific page?

那年仲夏 提交于 2019-12-21 03:19:24
问题 I have an issue with a script only working when refreshing the page and so I'm trying to disable Turbolinks for only that page. The code below doesn't work. However, if I add the "data-no-turbolink" attribute directly to the body tag in application.html.erb it works. How do I disable Turbolinks in my view? I have followed the solution posted here, Rails 4: disable Turbolinks in a specific page but I can't get it to work. I have the gem 'jquery-turbolinks' installed. policy.html.erb <% content

Rails turbolinks break submit remote form

流过昼夜 提交于 2019-12-19 04:09:14
问题 I'm having a rather weird problem using Rails 4, Turbolinks and a remote form. I have a form looking like: <%= form_for [object], remote: true do |f| %> <td><%= f.text_field :name, class: 'form-control' %></td> <td><%= f.email_field :email, class: 'form-control' %></td> <td><%= f.submit button_name, class: 'btn btn-sm btn-primary' %></td> <% end %> This form adds (creates) a new object. It does however not always work: When I load the page directly using the URL or a refresh; it works When I