dropzonejs-rails 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWJiY2ExYTZlZWYwOTM0Zjc5OWJiODI3MWE2YzJlNThlYmM3Nzg4MA==
4
+ NjA5NjgxODJhNTE2OTc2ZTEyMWViNWJlMzU2ZWJkMzE0NTBlMDk5Yg==
5
5
  data.tar.gz: !binary |-
6
- NWFjMmRhNjcxZGMxODU0ODUxN2RlOTVmZDNiZjA3ZGQ4ODU4ZDNhMw==
6
+ MTZkYTE1ODU2N2MyYzJkNzBlZDY1MjA1NjdjMjA0MjQ2YWY2YzNlMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZTM2NmI3ZjQ1MWUyM2JmMmIyNjA3ZThhMmU0YzQ2ODU3NWVmYTBiYTk5NmUy
10
- OTBkOWVlZjQyYjhlYjUzY2MwY2VlYzdlY2Q4YzM3MDlkOTZkYTZjZTMyMDRi
11
- ODJiNGIyZGE2MThlMWMzMmJiOWZlNzI0NzFjMzg1NjMzZGY2Yzg=
9
+ YWY5NmIyNGQwNTRhNzI4NDBjMTUxN2RmMjliNTEyZTYyNGQ3MzZmMGNkNGNh
10
+ ZDBiMjY5ZTc5M2JlZTcwYTUzMjZmZjQzZTlmZTBkMjNjYTFiMDkxM2FmZDJh
11
+ MThlNjJlZjE5NjlkYjFiNjE2MzkyZmY1OGZiNzhhYTQyMWExNDU=
12
12
  data.tar.gz: !binary |-
13
- MGFkMWE2YzYwNzI5ZTEzYTljMDg0OWZiOGM5MWMwMjZhOTA2YzVkYzc0YWRl
14
- NDRjYzJkOGEzZTBkODhhMTQ5ZTAyOWI3NTRmMzlkMmFlZDY1ZTU1MDc0MDhl
15
- NmFhZjNmMWVlZTQ0NGNlYWI3MTkzYTdjNjA2OWNjYTZjYjg1MmY=
13
+ NWY3NjI2N2JjNGE3MDQ4MjYxOThjMzhlMmM4NGNjNGJmNDNjYjE4NGQ5ZTUz
14
+ OGY0MzBhNjkyYzc5MTNiMjZkYjdjNzhmZTYwYTA4NzNiOTIwYzRjZmMwMmRl
15
+ OTJlMDdmZjg5Yjc3NmU2YjFjMGQ5NjVlMjI1NzUxMGZiZjgzNWM=
data/README.md CHANGED
@@ -21,6 +21,15 @@ After that, you need to make `dropzone.js` available on your pages. To do that,
21
21
  //= require dropzone
22
22
  ```
23
23
 
24
+ And if you would like to use one of the styles bundled with Dropzone, add to your `application.css`:
25
+ ```scss
26
+ //= require dropzone/basic
27
+ ```
28
+ or
29
+ ```scss
30
+ //= require dropzone/dropzone
31
+ ```
32
+
24
33
  And **Bam!** - you're all set.
25
34
 
26
35
 
data/Rakefile CHANGED
@@ -12,8 +12,26 @@ require 'open-uri'
12
12
 
13
13
  desc 'Get latest dropzone js build'
14
14
  task :get do
15
- source = "https://raw.github.com/enyo/dropzone/v#{DropzonejsRails::DROPZONE_VERSION}/downloads/dropzone.js"
16
- target = DropzonejsRails::Engine.root.join('vendor/assets/javascripts/dropzone.js')
15
+ download_dropzone_file 'dropzone.js', 'vendor/assets/javascripts/dropzone.js'
16
+ download_dropzone_file 'css/basic.css', 'vendor/assets/stylesheets/dropzone/basic.css.scss'
17
+ download_dropzone_file 'css/dropzone.css', 'vendor/assets/stylesheets/dropzone/dropzone.css.scss'
18
+ download_dropzone_file 'images/spritemap.png', 'vendor/assets/images/dropzone/spritemap.png'
19
+ download_dropzone_file 'images/spritemap@2x.png', 'vendor/assets/images/dropzone/spritemap@2x.png'
17
20
 
18
- open(target, "w+") { |f| f << open(source).read }
21
+ fix_image_links 'vendor/assets/stylesheets/dropzone/basic.css.scss'
22
+ fix_image_links 'vendor/assets/stylesheets/dropzone/dropzone.css.scss'
23
+ end
24
+
25
+ def download_dropzone_file(source_file, target_file)
26
+ source = "https://raw.github.com/enyo/dropzone/v#{DropzonejsRails::DROPZONE_VERSION}/downloads/#{source_file}"
27
+ target = DropzonejsRails::Engine.root.join(target_file)
28
+
29
+ File.open(target, 'wb+') { |f| f << open(source, 'rb').read }
30
+ end
31
+
32
+ def fix_image_links(css_file)
33
+ file_name = DropzonejsRails::Engine.root.join(css_file)
34
+ original_css = File.read(file_name)
35
+ fixed_css = original_css.gsub(/url\(\"\.\.\/images\/(.+\.png)\"\)/, 'image-path("dropzone/\1")')
36
+ File.open(file_name, "w") {|file| file << fixed_css}
19
37
  end
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.1.3'
3
- DROPZONE_VERSION = '2.0.4'
2
+ VERSION = '0.1.4'
3
+ DROPZONE_VERSION = '2.0.11'
4
4
  end
@@ -368,8 +368,6 @@ module.exports = require("./lib/dropzone.js");
368
368
 
369
369
  });
370
370
  require.register("dropzone/lib/dropzone.js", function(exports, require, module){
371
- // Generated by CoffeeScript 1.4.0
372
-
373
371
  /*
374
372
  #
375
373
  # More info at [www.dropzonejs.com](http://www.dropzonejs.com)
@@ -398,25 +396,25 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
398
396
 
399
397
 
400
398
  (function() {
401
- var Dropzone, Em, camelize, contentLoaded, createElement, noop, without,
399
+ var Dropzone, Em, camelize, contentLoaded, noop, without,
402
400
  __hasProp = {}.hasOwnProperty,
403
401
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
404
- __slice = [].slice;
402
+ __slice = [].slice,
403
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
405
404
 
406
405
  Em = typeof Emitter !== "undefined" && Emitter !== null ? Emitter : require("emitter");
407
406
 
408
407
  noop = function() {};
409
408
 
410
409
  Dropzone = (function(_super) {
411
-
412
410
  __extends(Dropzone, _super);
413
411
 
414
412
  /*
415
- This is a list of all available events you can register on a dropzone object.
413
+ This is a list of all available events you can register on a dropzone object.
416
414
 
417
- You can register an event handler like this:
415
+ You can register an event handler like this:
418
416
 
419
- dropzone.on("dragEnter", function() { });
417
+ dropzone.on("dragEnter", function() { });
420
418
  */
421
419
 
422
420
 
@@ -424,6 +422,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
424
422
 
425
423
  Dropzone.prototype.defaultOptions = {
426
424
  url: null,
425
+ method: "post",
427
426
  parallelUploads: 2,
428
427
  maxFilesize: 256,
429
428
  paramName: "file",
@@ -446,6 +445,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
446
445
  },
447
446
  fallback: function() {
448
447
  var child, messageElement, span, _i, _len, _ref;
448
+
449
449
  this.element.className = "" + this.element.className + " browser-not-supported";
450
450
  _ref = this.element.getElementsByTagName("div");
451
451
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -457,7 +457,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
457
457
  }
458
458
  }
459
459
  if (!messageElement) {
460
- messageElement = createElement("<div class=\"message\"><span></span></div>");
460
+ messageElement = Dropzone.createElement("<div class=\"message\"><span></span></div>");
461
461
  this.element.appendChild(messageElement);
462
462
  }
463
463
  span = messageElement.getElementsByTagName("span")[0];
@@ -467,12 +467,12 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
467
467
  return this.element.appendChild(this.getFallbackForm());
468
468
  },
469
469
  /*
470
- Those functions register themselves to the events on init and handle all
471
- the user interface specific stuff. Overwriting them won't break the upload
472
- but can break the way it's displayed.
473
- You can overwrite them if you don't like the default behavior. If you just
474
- want to add an additional event handler, register it on the dropzone object
475
- and don't overwrite those options.
470
+ Those functions register themselves to the events on init and handle all
471
+ the user interface specific stuff. Overwriting them won't break the upload
472
+ but can break the way it's displayed.
473
+ You can overwrite them if you don't like the default behavior. If you just
474
+ want to add an additional event handler, register it on the dropzone object
475
+ and don't overwrite those options.
476
476
  */
477
477
 
478
478
  drop: function(e) {
@@ -500,10 +500,10 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
500
500
  return this.element.classList.remove("started");
501
501
  },
502
502
  addedfile: function(file) {
503
- file.previewTemplate = createElement(this.options.previewTemplate);
503
+ file.previewTemplate = Dropzone.createElement(this.options.previewTemplate);
504
504
  this.previewsContainer.appendChild(file.previewTemplate);
505
505
  file.previewTemplate.querySelector(".filename span").textContent = file.name;
506
- return file.previewTemplate.querySelector(".details").appendChild(createElement("<div class=\"size\">" + (this.filesize(file.size)) + "</div>"));
506
+ return file.previewTemplate.querySelector(".details").appendChild(Dropzone.createElement("<div class=\"size\">" + (this.filesize(file.size)) + "</div>"));
507
507
  },
508
508
  removedfile: function(file) {
509
509
  return file.previewTemplate.parentNode.removeChild(file.previewTemplate);
@@ -511,7 +511,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
511
511
  thumbnail: function(file, dataUrl) {
512
512
  file.previewTemplate.classList.remove("file-preview");
513
513
  file.previewTemplate.classList.add("image-preview");
514
- return file.previewTemplate.querySelector(".details").appendChild(createElement("<img alt=\"" + file.name + "\" src=\"" + dataUrl + "\"/>"));
514
+ return file.previewTemplate.querySelector(".details").appendChild(Dropzone.createElement("<img alt=\"" + file.name + "\" src=\"" + dataUrl + "\"/>"));
515
515
  },
516
516
  error: function(file, message) {
517
517
  file.previewTemplate.classList.add("error");
@@ -533,6 +533,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
533
533
 
534
534
  function Dropzone(element, options) {
535
535
  var elementId, elementOptions, extend, fallback, _ref;
536
+
536
537
  this.element = element;
537
538
  this.version = Dropzone.version;
538
539
  this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
@@ -550,6 +551,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
550
551
  elementOptions = (_ref = (elementId ? Dropzone.options[camelize(elementId)] : void 0)) != null ? _ref : {};
551
552
  extend = function() {
552
553
  var key, object, objects, target, val, _i, _len;
554
+
553
555
  target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
554
556
  for (_i = 0, _len = objects.length; _i < _len; _i++) {
555
557
  object = objects[_i];
@@ -567,6 +569,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
567
569
  if (!this.options.url) {
568
570
  throw new Error("No URL provided.");
569
571
  }
572
+ this.options.method = this.options.method.toUpperCase();
570
573
  if (!Dropzone.isBrowserSupported()) {
571
574
  return this.options.fallback.call(this);
572
575
  }
@@ -589,28 +592,37 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
589
592
  }
590
593
 
591
594
  Dropzone.prototype.init = function() {
592
- var eventName, noPropagation, _i, _len, _ref, _ref1,
595
+ var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1,
593
596
  _this = this;
597
+
594
598
  if (this.element.tagName === "form") {
595
599
  this.element.setAttribute("enctype", "multipart/form-data");
596
600
  }
597
601
  if (this.element.classList.contains("dropzone") && !this.element.querySelector(".message")) {
598
- this.element.appendChild(createElement("<div class=\"default message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
602
+ this.element.appendChild(Dropzone.createElement("<div class=\"default message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
599
603
  }
600
604
  if (this.options.clickable) {
601
- this.hiddenFileInput = document.createElement("input");
602
- this.hiddenFileInput.setAttribute("type", "file");
603
- this.hiddenFileInput.setAttribute("multiple", "multiple");
604
- this.hiddenFileInput.style.display = "none";
605
- document.body.appendChild(this.hiddenFileInput);
606
- this.hiddenFileInput.addEventListener("change", function() {
607
- var files;
608
- files = _this.hiddenFileInput.files;
609
- if (files.length) {
610
- _this.emit("selectedfiles", files);
611
- return _this.handleFiles(files);
605
+ setupHiddenFileInput = function() {
606
+ if (_this.hiddenFileInput) {
607
+ document.body.removeChild(_this.hiddenFileInput);
612
608
  }
613
- });
609
+ _this.hiddenFileInput = document.createElement("input");
610
+ _this.hiddenFileInput.setAttribute("type", "file");
611
+ _this.hiddenFileInput.setAttribute("multiple", "multiple");
612
+ _this.hiddenFileInput.style.display = "none";
613
+ document.body.appendChild(_this.hiddenFileInput);
614
+ return _this.hiddenFileInput.addEventListener("change", function() {
615
+ var files;
616
+
617
+ files = _this.hiddenFileInput.files;
618
+ if (files.length) {
619
+ _this.emit("selectedfiles", files);
620
+ _this.handleFiles(files);
621
+ }
622
+ return setupHiddenFileInput();
623
+ });
624
+ };
625
+ setupHiddenFileInput();
614
626
  }
615
627
  this.files = [];
616
628
  this.filesQueue = [];
@@ -656,7 +668,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
656
668
  if (!_this.options.clickable) {
657
669
  return;
658
670
  }
659
- if (evt.target === _this.element || evt.target === _this.element.querySelector(".message")) {
671
+ if (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".message"))) {
660
672
  return _this.hiddenFileInput.click();
661
673
  }
662
674
  }
@@ -667,6 +679,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
667
679
 
668
680
  Dropzone.prototype.getFallbackForm = function() {
669
681
  var existingFallback, fields, fieldsString, form;
682
+
670
683
  if (existingFallback = this.getExistingFallback()) {
671
684
  return existingFallback;
672
685
  }
@@ -675,21 +688,23 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
675
688
  fieldsString += "<p>" + this.options.dictFallbackText + "</p>";
676
689
  }
677
690
  fieldsString += "<input type=\"file\" name=\"" + this.options.paramName + "\" multiple=\"multiple\" /><button type=\"submit\">Upload!</button></div>";
678
- fields = createElement(fieldsString);
691
+ fields = Dropzone.createElement(fieldsString);
679
692
  if (this.element.tagName !== "FORM") {
680
- form = createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"post\"></form>");
693
+ form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>");
681
694
  form.appendChild(fields);
682
695
  } else {
683
696
  this.element.setAttribute("enctype", "multipart/form-data");
684
- this.element.setAttribute("method", "post");
697
+ this.element.setAttribute("method", this.options.method);
685
698
  }
686
699
  return form != null ? form : fields;
687
700
  };
688
701
 
689
702
  Dropzone.prototype.getExistingFallback = function() {
690
703
  var fallback, getFallback, tagName, _i, _len, _ref;
704
+
691
705
  getFallback = function(elements) {
692
706
  var el, _i, _len;
707
+
693
708
  for (_i = 0, _len = elements.length; _i < _len; _i++) {
694
709
  el = elements[_i];
695
710
  if (/(^| )fallback($| )/.test(el.className)) {
@@ -708,6 +723,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
708
723
 
709
724
  Dropzone.prototype.setupEventListeners = function() {
710
725
  var event, listener, _ref, _results;
726
+
711
727
  _ref = this.listeners;
712
728
  _results = [];
713
729
  for (event in _ref) {
@@ -719,6 +735,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
719
735
 
720
736
  Dropzone.prototype.removeEventListeners = function() {
721
737
  var event, listener, _ref, _results;
738
+
722
739
  _ref = this.listeners;
723
740
  _results = [];
724
741
  for (event in _ref) {
@@ -746,6 +763,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
746
763
 
747
764
  Dropzone.prototype.filesize = function(size) {
748
765
  var string;
766
+
749
767
  if (size >= 100000000000) {
750
768
  size = size / 100000000000;
751
769
  string = "TB";
@@ -767,6 +785,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
767
785
 
768
786
  Dropzone.prototype.drop = function(e) {
769
787
  var files;
788
+
770
789
  if (!e.dataTransfer) {
771
790
  return;
772
791
  }
@@ -779,6 +798,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
779
798
 
780
799
  Dropzone.prototype.handleFiles = function(files) {
781
800
  var file, _i, _len, _results;
801
+
782
802
  _results = [];
783
803
  for (_i = 0, _len = files.length; _i < _len; _i++) {
784
804
  file = files[_i];
@@ -797,6 +817,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
797
817
 
798
818
  Dropzone.prototype.addFile = function(file) {
799
819
  var _this = this;
820
+
800
821
  this.files.push(file);
801
822
  this.emit("addedfile", file);
802
823
  if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
@@ -826,15 +847,31 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
826
847
  }
827
848
  };
828
849
 
850
+ Dropzone.prototype.removeAllFiles = function() {
851
+ var file, _i, _len, _ref;
852
+
853
+ _ref = this.files.slice();
854
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
855
+ file = _ref[_i];
856
+ if (__indexOf.call(this.filesProcessing, file) < 0) {
857
+ this.removeFile(file);
858
+ }
859
+ }
860
+ return null;
861
+ };
862
+
829
863
  Dropzone.prototype.createThumbnail = function(file) {
830
864
  var fileReader,
831
865
  _this = this;
866
+
832
867
  fileReader = new FileReader;
833
868
  fileReader.onload = function() {
834
869
  var img;
870
+
835
871
  img = new Image;
836
872
  img.onload = function() {
837
873
  var canvas, ctx, srcHeight, srcRatio, srcWidth, srcX, srcY, thumbnail, trgHeight, trgRatio, trgWidth, trgX, trgY;
874
+
838
875
  canvas = document.createElement("canvas");
839
876
  ctx = canvas.getContext("2d");
840
877
  srcX = 0;
@@ -876,6 +913,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
876
913
 
877
914
  Dropzone.prototype.processQueue = function() {
878
915
  var i, parallelUploads, processingLength;
916
+
879
917
  parallelUploads = this.options.parallelUploads;
880
918
  processingLength = this.filesProcessing.length;
881
919
  i = processingLength;
@@ -898,13 +936,15 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
898
936
  Dropzone.prototype.uploadFile = function(file) {
899
937
  var formData, handleError, input, inputName, inputType, key, progressObj, value, xhr, _i, _len, _ref, _ref1, _ref2,
900
938
  _this = this;
939
+
901
940
  xhr = new XMLHttpRequest();
902
- xhr.open("POST", this.options.url, true);
941
+ xhr.open(this.options.method, this.options.url, true);
903
942
  handleError = function() {
904
943
  return _this.errorProcessing(file, xhr.responseText || ("Server responded with " + xhr.status + " code."));
905
944
  };
906
945
  xhr.onload = function(e) {
907
946
  var response, _ref;
947
+
908
948
  if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
909
949
  return handleError();
910
950
  } else {
@@ -935,7 +975,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
935
975
  formData.append(key, value);
936
976
  }
937
977
  }
938
- if (this.element.tagName = "FORM") {
978
+ if (this.element.tagName === "FORM") {
939
979
  _ref2 = this.element.querySelectorAll("input, textarea, select, button");
940
980
  for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
941
981
  input = _ref2[_i];
@@ -972,7 +1012,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
972
1012
 
973
1013
  })(Em);
974
1014
 
975
- Dropzone.version = "2.0.4";
1015
+ Dropzone.version = "2.0.11";
976
1016
 
977
1017
  Dropzone.options = {};
978
1018
 
@@ -980,6 +1020,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
980
1020
 
981
1021
  Dropzone.forElement = function(element) {
982
1022
  var instance, _i, _len, _ref;
1023
+
983
1024
  if (typeof element === "string") {
984
1025
  element = document.querySelector(element);
985
1026
  }
@@ -997,6 +1038,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
997
1038
 
998
1039
  Dropzone.isBrowserSupported = function() {
999
1040
  var capableBrowser, regex, _i, _len, _ref;
1041
+
1000
1042
  capableBrowser = true;
1001
1043
  if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
1002
1044
  if (!("classList" in document.createElement("a"))) {
@@ -1019,6 +1061,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1019
1061
 
1020
1062
  without = function(list, rejectedItem) {
1021
1063
  var item, _i, _len, _results;
1064
+
1022
1065
  _results = [];
1023
1066
  for (_i = 0, _len = list.length; _i < _len; _i++) {
1024
1067
  item = list[_i];
@@ -1035,13 +1078,26 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1035
1078
  });
1036
1079
  };
1037
1080
 
1038
- createElement = function(string) {
1081
+ Dropzone.createElement = function(string) {
1039
1082
  var div;
1083
+
1040
1084
  div = document.createElement("div");
1041
1085
  div.innerHTML = string;
1042
1086
  return div.childNodes[0];
1043
1087
  };
1044
1088
 
1089
+ Dropzone.elementInside = function(element, container) {
1090
+ if (element === container) {
1091
+ return true;
1092
+ }
1093
+ while (element = element.parentNode) {
1094
+ if (element === container) {
1095
+ return true;
1096
+ }
1097
+ }
1098
+ return false;
1099
+ };
1100
+
1045
1101
  if (typeof jQuery !== "undefined" && jQuery !== null) {
1046
1102
  jQuery.fn.dropzone = function(options) {
1047
1103
  return this.each(function() {
@@ -1058,6 +1114,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1058
1114
 
1059
1115
  contentLoaded = function(win, fn) {
1060
1116
  var add, doc, done, init, poll, pre, rem, root, top;
1117
+
1061
1118
  done = false;
1062
1119
  top = true;
1063
1120
  doc = win.document;
@@ -1075,9 +1132,12 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1075
1132
  }
1076
1133
  };
1077
1134
  poll = function() {
1135
+ var e;
1136
+
1078
1137
  try {
1079
1138
  root.doScroll("left");
1080
- } catch (e) {
1139
+ } catch (_error) {
1140
+ e = _error;
1081
1141
  setTimeout(poll, 50);
1082
1142
  return;
1083
1143
  }
@@ -1100,12 +1160,14 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1100
1160
 
1101
1161
  contentLoaded(window, function() {
1102
1162
  var checkElements, dropzone, dropzones, _i, _len, _results;
1163
+
1103
1164
  if (false) {
1104
1165
  dropzones = document.querySelectorAll(".dropzone");
1105
1166
  } else {
1106
1167
  dropzones = [];
1107
1168
  checkElements = function(elements) {
1108
1169
  var el, _i, _len, _results;
1170
+
1109
1171
  _results = [];
1110
1172
  for (_i = 0, _len = elements.length; _i < _len; _i++) {
1111
1173
  el = elements[_i];
@@ -0,0 +1,156 @@
1
+ /* The MIT License */
2
+ .dropzone,
3
+ .dropzone *,
4
+ .dropzone-previews,
5
+ .dropzone-previews * {
6
+ -webkit-box-sizing: border-box;
7
+ -moz-box-sizing: border-box;
8
+ box-sizing: border-box;
9
+ }
10
+ .dropzone {
11
+ position: relative;
12
+ border: 1px solid rgba(0,0,0,0.08);
13
+ background: rgba(0,0,0,0.02);
14
+ padding: 1em;
15
+ }
16
+ .dropzone.clickable {
17
+ cursor: pointer;
18
+ }
19
+ .dropzone.clickable .message,
20
+ .dropzone.clickable .message span {
21
+ cursor: pointer;
22
+ }
23
+ .dropzone.clickable * {
24
+ cursor: default;
25
+ }
26
+ .dropzone .message {
27
+ opacity: 1;
28
+ -ms-filter: none;
29
+ filter: none;
30
+ }
31
+ .dropzone.drag-hover {
32
+ border-color: rgba(0,0,0,0.15);
33
+ background: rgba(0,0,0,0.04);
34
+ }
35
+ .dropzone.started .message {
36
+ display: none;
37
+ }
38
+ .dropzone .preview,
39
+ .dropzone-previews .preview {
40
+ background: rgba(255,255,255,0.8);
41
+ position: relative;
42
+ display: inline-block;
43
+ margin: 17px;
44
+ vertical-align: top;
45
+ border: 1px solid #acacac;
46
+ padding: 6px 6px 6px 6px;
47
+ }
48
+ .dropzone .preview .details,
49
+ .dropzone-previews .preview .details {
50
+ width: 100px;
51
+ height: 100px;
52
+ position: relative;
53
+ background: #ebebeb;
54
+ padding: 5px;
55
+ margin-bottom: 22px;
56
+ }
57
+ .dropzone .preview .details .filename,
58
+ .dropzone-previews .preview .details .filename {
59
+ overflow: hidden;
60
+ height: 100%;
61
+ }
62
+ .dropzone .preview .details img,
63
+ .dropzone-previews .preview .details img {
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ width: 100px;
68
+ height: 100px;
69
+ }
70
+ .dropzone .preview .details .size,
71
+ .dropzone-previews .preview .details .size {
72
+ position: absolute;
73
+ bottom: -28px;
74
+ left: 3px;
75
+ height: 28px;
76
+ line-height: 28px;
77
+ }
78
+ .dropzone .preview.error .error-mark,
79
+ .dropzone-previews .preview.error .error-mark {
80
+ display: block;
81
+ }
82
+ .dropzone .preview.success .success-mark,
83
+ .dropzone-previews .preview.success .success-mark {
84
+ display: block;
85
+ }
86
+ .dropzone .preview:hover .details img,
87
+ .dropzone-previews .preview:hover .details img {
88
+ display: none;
89
+ }
90
+ .dropzone .preview:hover .success-mark,
91
+ .dropzone-previews .preview:hover .success-mark,
92
+ .dropzone .preview:hover .error-mark,
93
+ .dropzone-previews .preview:hover .error-mark {
94
+ display: none;
95
+ }
96
+ .dropzone .preview .success-mark,
97
+ .dropzone-previews .preview .success-mark,
98
+ .dropzone .preview .error-mark,
99
+ .dropzone-previews .preview .error-mark {
100
+ display: none;
101
+ position: absolute;
102
+ width: 40px;
103
+ height: 40px;
104
+ font-size: 30px;
105
+ text-align: center;
106
+ right: -10px;
107
+ top: -10px;
108
+ }
109
+ .dropzone .preview .success-mark,
110
+ .dropzone-previews .preview .success-mark {
111
+ color: #8cc657;
112
+ }
113
+ .dropzone .preview .error-mark,
114
+ .dropzone-previews .preview .error-mark {
115
+ color: #ee162d;
116
+ }
117
+ .dropzone .preview .progress,
118
+ .dropzone-previews .preview .progress {
119
+ position: absolute;
120
+ top: 100px;
121
+ left: 6px;
122
+ right: 6px;
123
+ height: 6px;
124
+ background: #d7d7d7;
125
+ display: none;
126
+ }
127
+ .dropzone .preview .progress .upload,
128
+ .dropzone-previews .preview .progress .upload {
129
+ position: absolute;
130
+ top: 0;
131
+ bottom: 0;
132
+ left: 0;
133
+ width: 0%;
134
+ background-color: #8cc657;
135
+ }
136
+ .dropzone .preview.processing .progress,
137
+ .dropzone-previews .preview.processing .progress {
138
+ display: block;
139
+ }
140
+ .dropzone .preview .error-message,
141
+ .dropzone-previews .preview .error-message {
142
+ display: none;
143
+ position: absolute;
144
+ top: -5px;
145
+ left: -20px;
146
+ background: rgba(245,245,245,0.8);
147
+ padding: 8px 10px;
148
+ color: #800;
149
+ min-width: 140px;
150
+ max-width: 500px;
151
+ z-index: 500;
152
+ }
153
+ .dropzone .preview:hover.error .error-message,
154
+ .dropzone-previews .preview:hover.error .error-message {
155
+ display: block;
156
+ }
@@ -0,0 +1,395 @@
1
+ /* The MIT License */
2
+ .dropzone,
3
+ .dropzone *,
4
+ .dropzone-previews,
5
+ .dropzone-previews * {
6
+ -webkit-box-sizing: border-box;
7
+ -moz-box-sizing: border-box;
8
+ box-sizing: border-box;
9
+ }
10
+ .dropzone {
11
+ position: relative;
12
+ border: 1px solid rgba(0,0,0,0.08);
13
+ background: rgba(0,0,0,0.02);
14
+ padding: 1em;
15
+ }
16
+ .dropzone.clickable {
17
+ cursor: pointer;
18
+ }
19
+ .dropzone.clickable .message,
20
+ .dropzone.clickable .message span {
21
+ cursor: pointer;
22
+ }
23
+ .dropzone.clickable * {
24
+ cursor: default;
25
+ }
26
+ .dropzone .message {
27
+ opacity: 1;
28
+ -ms-filter: none;
29
+ filter: none;
30
+ }
31
+ .dropzone.drag-hover {
32
+ border-color: rgba(0,0,0,0.15);
33
+ background: rgba(0,0,0,0.04);
34
+ }
35
+ .dropzone.started .message {
36
+ display: none;
37
+ }
38
+ .dropzone .preview,
39
+ .dropzone-previews .preview {
40
+ background: rgba(255,255,255,0.8);
41
+ position: relative;
42
+ display: inline-block;
43
+ margin: 17px;
44
+ vertical-align: top;
45
+ border: 1px solid #acacac;
46
+ padding: 6px 6px 6px 6px;
47
+ }
48
+ .dropzone .preview .details,
49
+ .dropzone-previews .preview .details {
50
+ width: 100px;
51
+ height: 100px;
52
+ position: relative;
53
+ background: #ebebeb;
54
+ padding: 5px;
55
+ margin-bottom: 22px;
56
+ }
57
+ .dropzone .preview .details .filename,
58
+ .dropzone-previews .preview .details .filename {
59
+ overflow: hidden;
60
+ height: 100%;
61
+ }
62
+ .dropzone .preview .details img,
63
+ .dropzone-previews .preview .details img {
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ width: 100px;
68
+ height: 100px;
69
+ }
70
+ .dropzone .preview .details .size,
71
+ .dropzone-previews .preview .details .size {
72
+ position: absolute;
73
+ bottom: -28px;
74
+ left: 3px;
75
+ height: 28px;
76
+ line-height: 28px;
77
+ }
78
+ .dropzone .preview.error .error-mark,
79
+ .dropzone-previews .preview.error .error-mark {
80
+ display: block;
81
+ }
82
+ .dropzone .preview.success .success-mark,
83
+ .dropzone-previews .preview.success .success-mark {
84
+ display: block;
85
+ }
86
+ .dropzone .preview:hover .details img,
87
+ .dropzone-previews .preview:hover .details img {
88
+ display: none;
89
+ }
90
+ .dropzone .preview:hover .success-mark,
91
+ .dropzone-previews .preview:hover .success-mark,
92
+ .dropzone .preview:hover .error-mark,
93
+ .dropzone-previews .preview:hover .error-mark {
94
+ display: none;
95
+ }
96
+ .dropzone .preview .success-mark,
97
+ .dropzone-previews .preview .success-mark,
98
+ .dropzone .preview .error-mark,
99
+ .dropzone-previews .preview .error-mark {
100
+ display: none;
101
+ position: absolute;
102
+ width: 40px;
103
+ height: 40px;
104
+ font-size: 30px;
105
+ text-align: center;
106
+ right: -10px;
107
+ top: -10px;
108
+ }
109
+ .dropzone .preview .success-mark,
110
+ .dropzone-previews .preview .success-mark {
111
+ color: #8cc657;
112
+ }
113
+ .dropzone .preview .error-mark,
114
+ .dropzone-previews .preview .error-mark {
115
+ color: #ee162d;
116
+ }
117
+ .dropzone .preview .progress,
118
+ .dropzone-previews .preview .progress {
119
+ position: absolute;
120
+ top: 100px;
121
+ left: 6px;
122
+ right: 6px;
123
+ height: 6px;
124
+ background: #d7d7d7;
125
+ display: none;
126
+ }
127
+ .dropzone .preview .progress .upload,
128
+ .dropzone-previews .preview .progress .upload {
129
+ position: absolute;
130
+ top: 0;
131
+ bottom: 0;
132
+ left: 0;
133
+ width: 0%;
134
+ background-color: #8cc657;
135
+ }
136
+ .dropzone .preview.processing .progress,
137
+ .dropzone-previews .preview.processing .progress {
138
+ display: block;
139
+ }
140
+ .dropzone .preview .error-message,
141
+ .dropzone-previews .preview .error-message {
142
+ display: none;
143
+ position: absolute;
144
+ top: -5px;
145
+ left: -20px;
146
+ background: rgba(245,245,245,0.8);
147
+ padding: 8px 10px;
148
+ color: #800;
149
+ min-width: 140px;
150
+ max-width: 500px;
151
+ z-index: 500;
152
+ }
153
+ .dropzone .preview:hover.error .error-message,
154
+ .dropzone-previews .preview:hover.error .error-message {
155
+ display: block;
156
+ }
157
+ .dropzone {
158
+ border: 1px solid rgba(0,0,0,0.03);
159
+ min-height: 360px;
160
+ -webkit-border-radius: 3px;
161
+ border-radius: 3px;
162
+ background: rgba(0,0,0,0.03);
163
+ padding: 23px;
164
+ }
165
+ .dropzone .default.message {
166
+ opacity: 1;
167
+ -ms-filter: none;
168
+ filter: none;
169
+ -webkit-transition: opacity 0.3s ease-in-out;
170
+ -moz-transition: opacity 0.3s ease-in-out;
171
+ -o-transition: opacity 0.3s ease-in-out;
172
+ -ms-transition: opacity 0.3s ease-in-out;
173
+ transition: opacity 0.3s ease-in-out;
174
+ background-image: image-path("dropzone/spritemap.png");
175
+ background-repeat: no-repeat;
176
+ background-position: 0 0;
177
+ position: absolute;
178
+ width: 428px;
179
+ height: 123px;
180
+ margin-left: -214px;
181
+ margin-top: -61.5px;
182
+ top: 50%;
183
+ left: 50%;
184
+ }
185
+ @media all and (-webkit-min-device-pixel-ratio: 1.5) {
186
+ .dropzone .default.message {
187
+ background-image: image-path("dropzone/spritemap@2x.png");
188
+ -webkit-background-size: 428px 406px;
189
+ -moz-background-size: 428px 406px;
190
+ background-size: 428px 406px;
191
+ }
192
+ }
193
+ .dropzone .default.message span {
194
+ display: none;
195
+ }
196
+ .dropzone.square .default.message {
197
+ background-position: 0 -123px;
198
+ width: 268px;
199
+ margin-left: -134px;
200
+ height: 174px;
201
+ margin-top: -87px;
202
+ }
203
+ .dropzone.drag-hover .message {
204
+ opacity: 0.15;
205
+ filter: alpha(opacity=15);
206
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=15)";
207
+ }
208
+ .dropzone.started .message {
209
+ display: block;
210
+ opacity: 0;
211
+ filter: alpha(opacity=0);
212
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
213
+ }
214
+ .dropzone .preview,
215
+ .dropzone-previews .preview {
216
+ -webkit-box-shadow: 1px 1px 4px rgba(0,0,0,0.16);
217
+ box-shadow: 1px 1px 4px rgba(0,0,0,0.16);
218
+ font-size: 14px;
219
+ }
220
+ .dropzone .preview .details img,
221
+ .dropzone-previews .preview .details img {
222
+ width: 100px;
223
+ height: 100px;
224
+ }
225
+ .dropzone .preview.image-preview:hover .details img,
226
+ .dropzone-previews .preview.image-preview:hover .details img {
227
+ display: block;
228
+ opacity: 0.1;
229
+ filter: alpha(opacity=10);
230
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)";
231
+ }
232
+ .dropzone .preview.success .success-mark,
233
+ .dropzone-previews .preview.success .success-mark {
234
+ opacity: 1;
235
+ -ms-filter: none;
236
+ filter: none;
237
+ }
238
+ .dropzone .preview.error .error-mark,
239
+ .dropzone-previews .preview.error .error-mark {
240
+ opacity: 1;
241
+ -ms-filter: none;
242
+ filter: none;
243
+ }
244
+ .dropzone .preview.error .progress .upload,
245
+ .dropzone-previews .preview.error .progress .upload {
246
+ background: #ee1e2d;
247
+ }
248
+ .dropzone .preview .error-mark,
249
+ .dropzone-previews .preview .error-mark,
250
+ .dropzone .preview .success-mark,
251
+ .dropzone-previews .preview .success-mark {
252
+ display: block;
253
+ opacity: 0;
254
+ filter: alpha(opacity=0);
255
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
256
+ -webkit-transition: opacity 0.4s ease-in-out;
257
+ -moz-transition: opacity 0.4s ease-in-out;
258
+ -o-transition: opacity 0.4s ease-in-out;
259
+ -ms-transition: opacity 0.4s ease-in-out;
260
+ transition: opacity 0.4s ease-in-out;
261
+ background-image: image-path("dropzone/spritemap.png");
262
+ background-repeat: no-repeat;
263
+ }
264
+ @media all and (-webkit-min-device-pixel-ratio: 1.5) {
265
+ .dropzone .preview .error-mark,
266
+ .dropzone-previews .preview .error-mark,
267
+ .dropzone .preview .success-mark,
268
+ .dropzone-previews .preview .success-mark {
269
+ background-image: image-path("dropzone/spritemap@2x.png");
270
+ -webkit-background-size: 428px 406px;
271
+ -moz-background-size: 428px 406px;
272
+ background-size: 428px 406px;
273
+ }
274
+ }
275
+ .dropzone .preview .error-mark span,
276
+ .dropzone-previews .preview .error-mark span,
277
+ .dropzone .preview .success-mark span,
278
+ .dropzone-previews .preview .success-mark span {
279
+ display: none;
280
+ }
281
+ .dropzone .preview .error-mark,
282
+ .dropzone-previews .preview .error-mark {
283
+ background-position: -268px -123px;
284
+ }
285
+ .dropzone .preview .success-mark,
286
+ .dropzone-previews .preview .success-mark {
287
+ background-position: -268px -163px;
288
+ }
289
+ .dropzone .preview .progress .upload,
290
+ .dropzone-previews .preview .progress .upload {
291
+ -webkit-animation: loading 0.4s linear infinite;
292
+ -moz-animation: loading 0.4s linear infinite;
293
+ -o-animation: loading 0.4s linear infinite;
294
+ -ms-animation: loading 0.4s linear infinite;
295
+ animation: loading 0.4s linear infinite;
296
+ -webkit-transition: width 0.3s ease-in-out;
297
+ -moz-transition: width 0.3s ease-in-out;
298
+ -o-transition: width 0.3s ease-in-out;
299
+ -ms-transition: width 0.3s ease-in-out;
300
+ transition: width 0.3s ease-in-out;
301
+ -webkit-border-radius: 2px;
302
+ border-radius: 2px;
303
+ position: absolute;
304
+ top: 0;
305
+ left: 0;
306
+ width: 0%;
307
+ height: 100%;
308
+ background-image: image-path("dropzone/spritemap.png");
309
+ background-repeat: repeat-x;
310
+ background-position: 0px -400px;
311
+ }
312
+ @media all and (-webkit-min-device-pixel-ratio: 1.5) {
313
+ .dropzone .preview .progress .upload,
314
+ .dropzone-previews .preview .progress .upload {
315
+ background-image: image-path("dropzone/spritemap@2x.png");
316
+ -webkit-background-size: 428px 406px;
317
+ -moz-background-size: 428px 406px;
318
+ background-size: 428px 406px;
319
+ }
320
+ }
321
+ .dropzone .preview.success .progress,
322
+ .dropzone-previews .preview.success .progress {
323
+ display: block;
324
+ opacity: 0;
325
+ filter: alpha(opacity=0);
326
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
327
+ -webkit-transition: opacity 0.4s ease-in-out;
328
+ -moz-transition: opacity 0.4s ease-in-out;
329
+ -o-transition: opacity 0.4s ease-in-out;
330
+ -ms-transition: opacity 0.4s ease-in-out;
331
+ transition: opacity 0.4s ease-in-out;
332
+ }
333
+ .dropzone .preview .error-message,
334
+ .dropzone-previews .preview .error-message {
335
+ display: block;
336
+ opacity: 0;
337
+ filter: alpha(opacity=0);
338
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
339
+ -webkit-transition: opacity 0.3s ease-in-out;
340
+ -moz-transition: opacity 0.3s ease-in-out;
341
+ -o-transition: opacity 0.3s ease-in-out;
342
+ -ms-transition: opacity 0.3s ease-in-out;
343
+ transition: opacity 0.3s ease-in-out;
344
+ }
345
+ .dropzone .preview:hover.error .error-message,
346
+ .dropzone-previews .preview:hover.error .error-message {
347
+ opacity: 1;
348
+ -ms-filter: none;
349
+ filter: none;
350
+ }
351
+ @-moz-keyframes loading {
352
+ 0% {
353
+ background-position: 0 -400px;
354
+ }
355
+
356
+ 100% {
357
+ background-position: -7px -400px;
358
+ }
359
+ }
360
+ @-webkit-keyframes loading {
361
+ 0% {
362
+ background-position: 0 -400px;
363
+ }
364
+
365
+ 100% {
366
+ background-position: -7px -400px;
367
+ }
368
+ }
369
+ @-o-keyframes loading {
370
+ 0% {
371
+ background-position: 0 -400px;
372
+ }
373
+
374
+ 100% {
375
+ background-position: -7px -400px;
376
+ }
377
+ }
378
+ @-ms-keyframes loading {
379
+ 0% {
380
+ background-position: 0 -400px;
381
+ }
382
+
383
+ 100% {
384
+ background-position: -7px -400px;
385
+ }
386
+ }
387
+ @keyframes loading {
388
+ 0% {
389
+ background-position: 0 -400px;
390
+ }
391
+
392
+ 100% {
393
+ background-position: -7px -400px;
394
+ }
395
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropzonejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Nahuel Cuesta Luengo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-26 00:00:00.000000000 Z
11
+ date: 2013-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -36,7 +36,11 @@ files:
36
36
  - lib/dropzonejs-rails/version.rb
37
37
  - lib/dropzonejs-rails.rb
38
38
  - lib/generators/dropzonejs-rails/install/install_generator.rb
39
+ - vendor/assets/images/dropzone/spritemap.png
40
+ - vendor/assets/images/dropzone/spritemap@2x.png
39
41
  - vendor/assets/javascripts/dropzone.js
42
+ - vendor/assets/stylesheets/dropzone/basic.css.scss
43
+ - vendor/assets/stylesheets/dropzone/dropzone.css.scss
40
44
  - LICENSE
41
45
  - Rakefile
42
46
  - README.md