Skip to content

Instantly share code, notes, and snippets.

@fmcgeough
Created April 13, 2018 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmcgeough/9617d651339d6925b677af8279b46fb9 to your computer and use it in GitHub Desktop.
Save fmcgeough/9617d651339d6925b677af8279b46fb9 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
Dropzone.options.dzUpload = {
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,
// The setting up of the dropzone
init: function() {
var myDropzone = this;
// First change the button to actually tell Dropzone to process the queue.
$("#create-button").click(function(e) {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
});
// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
// Gets triggered when the form is actually being sent.
// Hide the success button or the complete form.
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
});
}
}
</script>
<h2 class="text-center"> New Post Mortem</h2>
<%= form_for @changeset, post_mortems_path(@conn, :create), [multipart: true, id: "dzUpload", class: "dropzone"], fn f -> %>
<%= input f, :title %>
<%= input f, :summary %>
<%= input f, :jira_ticket %>
<%= select_input f, :lines_of_business, :multiple_select, @lines_of_business %>
<%= input f, :number_impacted_accounts, using: :number_input, user_label: "Number of Impacted Accounts" %>
<%= input f, :number_impacted_extensions, using: :number_input, user_label: "Number of Impacted Extensions" %>
<%= input f, :start_time %>
<%= input f, :end_time %>
<%= input f, :detect_time %>
<%= select_input f, :severity, :select, @severities %>
<%= select_input f, :incident_causes, :multiple_select, @incident_causes, user_label: "Incident Cause(s)" %>
<%= input f, :root_cause, using: :textarea %>
<%= input f, :lessons_learned, using: :textarea %>
<%= input f, :corrective_action, using: :textarea %>
<%= input f, :next_steps, using: :textarea, user_label: "Next Steps/Action Items" %>
<div id="" class="dropzone-previews"></div>
<div>
<br>
<%= submit "Create", class: "btn btn-primary", id: "create-button" %>
<%= link "Cancel", to: post_mortems_path(@conn, :index), class: "btn btn-danger" %>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment