dropzonejs-rails 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe9ee50a0edeab493470c4d53733167350ac2509
4
- data.tar.gz: 8b71aa171ac3937fa58ce8bc6502cb0d5af843dc
3
+ metadata.gz: 3e72ebde5086f7653ba4b2ff9faf9ba1247a832d
4
+ data.tar.gz: ca8b70f7a0ddbee0002bc570383bc76095d09e1b
5
5
  SHA512:
6
- metadata.gz: 554d70f56bc01d1e1be06fbfc5753ad04a363ebd24cb29b4ceed271524f534e8f258796d2925c1259fa3c400881928f8d696eb97b6a9293ca1f83c8ce6df449e
7
- data.tar.gz: c7b820d918653d23d0c7e2acd9978b55fb68f53641597862e4deae799fa888fc46406e74f3b3830b99900bde86399c12c1614b10106a754721da6ca77cd5a5b5
6
+ metadata.gz: 2721ae0a488c2a4fc21c7cc39517f6bb57de7d8047df5d598ba361b1b36e4082eb7be235ea932068512dde18486b721477d0d5127f74de78754b22ed931b8277
7
+ data.tar.gz: 8ed7a066b5a47585b2e77098bd230503785e121dd7ed8cc74d5b5605e72bbaa785df68e2d50e280ddfaace1d9e1f6c3e36bc1328d6bc22d4657757a7444cdc94
data/README.md CHANGED
@@ -4,7 +4,7 @@ Integrate [Matias Meno's Dropzone](http://www.dropzonejs.com/) awesome file uplo
4
4
 
5
5
  ## Version
6
6
 
7
- The latest version of this gem bundles **Dropzone v3.7.3**.
7
+ The latest version of this gem bundles **Dropzone v3.7.4**.
8
8
 
9
9
  ## Installation and usage
10
10
 
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.4.10'
3
- DROPZONE_VERSION = '3.7.3'
2
+ VERSION = '0.4.11'
3
+ DROPZONE_VERSION = '3.7.4'
4
4
  end
@@ -412,7 +412,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
412
412
  */
413
413
 
414
414
 
415
- Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "selectedfiles", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded"];
415
+ Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "selectedfiles", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached"];
416
416
 
417
417
  Dropzone.prototype.defaultOptions = {
418
418
  url: null,
@@ -445,7 +445,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
445
445
  dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
446
446
  dictRemoveFile: "Remove file",
447
447
  dictRemoveFileConfirmation: null,
448
- dictMaxFilesExceeded: "You can only upload {{maxFiles}} files.",
448
+ dictMaxFilesExceeded: "You can not upload any more files.",
449
449
  accept: function(file, done) {
450
450
  return done();
451
451
  },
@@ -569,9 +569,8 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
569
569
  }
570
570
  }
571
571
  });
572
- file.previewElement.appendChild(file._removeLink);
572
+ return file.previewElement.appendChild(file._removeLink);
573
573
  }
574
- return this._updateMaxFilesReachedClass();
575
574
  },
576
575
  removedfile: function(file) {
577
576
  var _ref;
@@ -596,6 +595,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
596
595
  error: function(file, message) {
597
596
  var node, _i, _len, _ref, _results;
598
597
  file.previewElement.classList.add("dz-error");
598
+ if (typeof message !== "String" && message.error) {
599
+ message = message.error;
600
+ }
599
601
  _ref = file.previewElement.querySelectorAll("[data-dz-errormessage]");
600
602
  _results = [];
601
603
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -640,6 +642,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
640
642
  },
641
643
  completemultiple: noop,
642
644
  maxfilesexceeded: noop,
645
+ maxfilesreached: noop,
643
646
  previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>✔</span></div>\n <div class=\"dz-error-mark\"><span>✘</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>"
644
647
  };
645
648
 
@@ -840,6 +843,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
840
843
  return _this.emit("dragenter", e);
841
844
  },
842
845
  "dragover": function(e) {
846
+ var efct;
847
+ efct = e.dataTransfer.effectAllowed;
848
+ e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy';
843
849
  noPropagation(e);
844
850
  return _this.emit("dragover", e);
845
851
  },
@@ -880,7 +886,8 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
880
886
  this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
881
887
  this.hiddenFileInput = null;
882
888
  }
883
- return delete this.element.dropzone;
889
+ delete this.element.dropzone;
890
+ return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
884
891
  };
885
892
 
886
893
  Dropzone.prototype.updateTotalUploadProgress = function() {
@@ -1007,18 +1014,18 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1007
1014
 
1008
1015
  Dropzone.prototype.filesize = function(size) {
1009
1016
  var string;
1010
- if (size >= 100000000000) {
1011
- size = size / 100000000000;
1012
- string = "TB";
1013
- } else if (size >= 100000000) {
1014
- size = size / 100000000;
1015
- string = "GB";
1016
- } else if (size >= 100000) {
1017
- size = size / 100000;
1018
- string = "MB";
1019
- } else if (size >= 100) {
1020
- size = size / 100;
1021
- string = "KB";
1017
+ if (size >= 1024 * 1024 * 1024 * 1024 / 10) {
1018
+ size = size / (1024 * 1024 * 1024 * 1024 / 10);
1019
+ string = "TiB";
1020
+ } else if (size >= 1024 * 1024 * 1024 / 10) {
1021
+ size = size / (1024 * 1024 * 1024 / 10);
1022
+ string = "GiB";
1023
+ } else if (size >= 1024 * 1024 / 10) {
1024
+ size = size / (1024 * 1024 / 10);
1025
+ string = "MiB";
1026
+ } else if (size >= 1024 / 10) {
1027
+ size = size / (1024 / 10);
1028
+ string = "KiB";
1022
1029
  } else {
1023
1030
  size = size * 10;
1024
1031
  string = "b";
@@ -1027,7 +1034,10 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1027
1034
  };
1028
1035
 
1029
1036
  Dropzone.prototype._updateMaxFilesReachedClass = function() {
1030
- if (this.options.maxFiles && this.getAcceptedFiles().length >= this.options.maxFiles) {
1037
+ if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
1038
+ if (this.getAcceptedFiles().length === this.options.maxFiles) {
1039
+ this.emit('maxfilesreached', this.files);
1040
+ }
1031
1041
  return this.element.classList.add("dz-max-files-reached");
1032
1042
  } else {
1033
1043
  return this.element.classList.remove("dz-max-files-reached");
@@ -1084,7 +1094,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1084
1094
  return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
1085
1095
  } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
1086
1096
  return done(this.options.dictInvalidFileType);
1087
- } else if (this.options.maxFiles && this.getAcceptedFiles().length >= this.options.maxFiles) {
1097
+ } else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
1088
1098
  done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
1089
1099
  return this.emit("maxfilesexceeded", file);
1090
1100
  } else {
@@ -1108,10 +1118,11 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1108
1118
  return this.accept(file, function(error) {
1109
1119
  if (error) {
1110
1120
  file.accepted = false;
1111
- return _this._errorProcessing([file], error);
1121
+ _this._errorProcessing([file], error);
1112
1122
  } else {
1113
- return _this.enqueueFile(file);
1123
+ _this.enqueueFile(file);
1114
1124
  }
1125
+ return _this._updateMaxFilesReachedClass();
1115
1126
  });
1116
1127
  };
1117
1128
 
@@ -1197,7 +1208,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1197
1208
  fileReader = new FileReader;
1198
1209
  fileReader.onload = function() {
1199
1210
  var img;
1200
- img = new Image;
1211
+ img = document.createElement("img");
1201
1212
  img.onload = function() {
1202
1213
  var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
1203
1214
  file.width = img.width;
@@ -1314,7 +1325,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1314
1325
  };
1315
1326
 
1316
1327
  Dropzone.prototype.uploadFiles = function(files) {
1317
- var file, formData, handleError, headerName, headerValue, headers, input, inputName, inputType, key, progressObj, response, updateProgress, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3,
1328
+ var file, formData, handleError, headerName, headerValue, headers, input, inputName, inputType, key, option, progressObj, response, updateProgress, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4,
1318
1329
  _this = this;
1319
1330
  xhr = new XMLHttpRequest();
1320
1331
  for (_i = 0, _len = files.length; _i < _len; _i++) {
@@ -1432,13 +1443,21 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1432
1443
  input = _ref2[_k];
1433
1444
  inputName = input.getAttribute("name");
1434
1445
  inputType = input.getAttribute("type");
1435
- if (!inputType || ((_ref3 = inputType.toLowerCase()) !== "checkbox" && _ref3 !== "radio") || input.checked) {
1446
+ if (input.tagName === "SELECT" && input.hasAttribute("multiple")) {
1447
+ _ref3 = input.options;
1448
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1449
+ option = _ref3[_l];
1450
+ if (option.selected) {
1451
+ formData.append(inputName, option.value);
1452
+ }
1453
+ }
1454
+ } else if (!inputType || ((_ref4 = inputType.toLowerCase()) !== "checkbox" && _ref4 !== "radio") || input.checked) {
1436
1455
  formData.append(inputName, input.value);
1437
1456
  }
1438
1457
  }
1439
1458
  }
1440
- for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
1441
- file = files[_l];
1459
+ for (_m = 0, _len4 = files.length; _m < _len4; _m++) {
1460
+ file = files[_m];
1442
1461
  formData.append("" + this.options.paramName + (this.options.uploadMultiple ? "[]" : ""), file, file.name);
1443
1462
  }
1444
1463
  return xhr.send(formData);
@@ -1482,13 +1501,13 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1482
1501
 
1483
1502
  })(Em);
1484
1503
 
1485
- Dropzone.version = "3.7.3";
1504
+ Dropzone.version = "3.7.4";
1486
1505
 
1487
1506
  Dropzone.options = {};
1488
1507
 
1489
1508
  Dropzone.optionsForElement = function(element) {
1490
- if (element.id) {
1491
- return Dropzone.options[camelize(element.id)];
1509
+ if (element.getAttribute("id")) {
1510
+ return Dropzone.options[camelize(element.getAttribute("id"))];
1492
1511
  } else {
1493
1512
  return void 0;
1494
1513
  }
@@ -124,6 +124,7 @@
124
124
  }
125
125
  .dropzone .dz-preview .dz-progress .dz-upload,
126
126
  .dropzone-previews .dz-preview .dz-progress .dz-upload {
127
+ display: block;
127
128
  position: absolute;
128
129
  top: 0;
129
130
  bottom: 0;
@@ -124,6 +124,7 @@
124
124
  }
125
125
  .dropzone .dz-preview .dz-progress .dz-upload,
126
126
  .dropzone-previews .dz-preview .dz-progress .dz-upload {
127
+ display: block;
127
128
  position: absolute;
128
129
  top: 0;
129
130
  bottom: 0;
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.4.10
4
+ version: 0.4.11
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-11-22 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit