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!