Skip to content

Instantly share code, notes, and snippets.

@ychaker
Created February 7, 2017 22:19
Show Gist options
  • Save ychaker/96dec385f1628373c455b9bf82274668 to your computer and use it in GitHub Desktop.
Save ychaker/96dec385f1628373c455b9bf82274668 to your computer and use it in GitHub Desktop.
Rails + Refile + Dropzone (9)
$('#alerts').html('<%= j render partial: "shared/alerts" %>');
$('input[type="file"]').val('');
$('input[name="doc[file]"]').val('');
var modal;
<% if @operation.valid? %>
modal = $('#upload-modal-<%= @model.doc_task.id %>');
modal.modal('hide');
modal.on('hidden.bs.modal', function() {
$('#tasks').html('<%= j render partial: "doc_tasks/list", locals: { pending_tasks: @pending_tasks, completed_tasks: @completed_tasks } %>');
});
<% else %>
modal = $('.upload-modal');
modal.modal('hide');
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment