1

I made a simple test application which uses DropzoneJS. I incorporated a Bootstrap navbar, and put the dropzone in one of the tabs. If i click on the tab the dropzone goes to fallback mode everytime. Only when I refresh the page it works again.

My code is as following:

    $(document).ready(function(){
  // disable auto discover
  Dropzone.autoDiscover = false;

  var dropzone = new Dropzone (".dropzone", {
    maxFilesize: 256, 
    paramName: "image[avatar]", 
    addRemoveLinks: false 
  });

  dropzone.on("success", function(file) {
    this.removeFile(file);
    $.getScript("/images");
  })
});

My view is as following:

<h1>Upload image</h1>


<div class ="container">
<%= form_for(Image.new, html: { multipart: true, class: "dropzone"}) do |f|  %>
  <div class="fallback">
    <%= f.file_field :avatar %><br>
    <%= f.submit "Upload my Avatar" %>
  </div>
 </div>
<% end %>

<div class="index">
  <%= render "index" %>
</div>

Hope somebody can help me out!

1 Answers1

0

Install the jQuery Tubrolinks gem would be a quick fix.

tangrufus
  • 357
  • 2
  • 13
  • This works, i'll try to find the underlying reasons as to why, but this worked. I would upvote it as well if i would have the rep, thanks! – Johan de Wild Jun 04 '15 at 19:56
  • Take a look [here](http://stackoverflow.com/questions/18769109/rails-4-turbo-link-error-uncaught-typeerror-cannot-read-property-position-of/18770219?noredirect=1#18770219) for more explanation – tangrufus Jun 04 '15 at 19:58