Sha256: c8b418bdf23def68ee8da587621085ee2b9cd49867d3a6db45cf793991bedb77

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

//= require jquery
//= require defile

"use strict";

document.addEventListener("DOMContentLoaded", function() {
  var form = document.querySelector("form#direct");

  if(form) {
    var input = document.querySelector("#post_document");

    form.addEventListener("upload:start", function() {
      var p = document.createElement("p");
      p.textContent = "Upload started";
      form.appendChild(p);
    });

    form.addEventListener("upload:complete", function(e) {
      var p = document.createElement("p");
      p.textContent = "Upload complete " + e.detail;
      form.appendChild(p);
    });

    form.addEventListener("upload:progress", function(e) {
      var p = document.createElement("p");
      p.textContent = "Upload progress " + e.detail.loaded + " " + e.detail.total;
      form.appendChild(p);
    });

    form.addEventListener("upload:failure", function(e) {
      var p = document.createElement("p");
      p.textContent = "Upload failure " + e.detail
      form.appendChild(p);
    });
  }
});

$(document).on("upload:success", "form#direct", function(e) {
  $("<p></p>").text("Upload success " + e.originalEvent.detail).appendTo(this);
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
defile-0.2.1 spec/defile/test_app/app/assets/javascripts/application.js
defile-0.2.0 spec/defile/test_app/app/assets/javascripts/application.js