dropzonejs-rails 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmM3ZjJkYjI3ZGExYjlmZGU3ZWFiYjc1M2ZjOTgyODg4OGRlZDk0ZA==
4
+ N2EzZDA4ZWZjNWMyMDBhYzkyZjk4MzJlZmJkOThlYzBkYjk5ODE5Mw==
5
5
  data.tar.gz: !binary |-
6
- Njc1ZjNkNjM5MjUzNTUzMDQxYmY1YTJhZTliMzQ3NGNlN2RlMTIwMg==
6
+ ODkyMjUyNzk0MzRlOGEwNjQyY2RmNTA1NjJmZTlkOTM4YWQ4ZDY5NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDI5YzRkMjZlNTk2MzY3NTk0MzFkMjNjNmU0ODUwNGEwZjM3Nzg4ZDY5Njk3
10
- YWNkNGNkOGVkMTVkMWU2MGExZDJmMGFhN2FlMTk1MDI5NDNhNzBmMTUxY2Jl
11
- YTFlNWRiNWVmZjkxNGNjOTc4MzhkOTg0ZWQxYzUxNWUxMjJjMDY=
9
+ OGY0MDExMjY2Y2Y3ZmVmYTEzMDc4ZWVjYzY0NDhhZWJjNTViOTUwNTNlNzgz
10
+ NWY2ZWI2ZWFkOTk3ZTZiMTYxNThmMzVhNTQyYjYxZDMyOGY0Yjg1YzY1MTQ4
11
+ MzkyMmY0Y2EyYTI5MmQzN2I2YjQzNDE1NzVhMWRmZDI3YWZkYTI=
12
12
  data.tar.gz: !binary |-
13
- NmM5MmVjNjA5NzM1OWQ3YTBhZjEzNjllYWU3MmU1MTk4OWIxOGUzYThiMzJj
14
- YzljMjhkMTU0YzVkZGNkYzAwODU3ODJiNTAwZjJhN2JhZDRiNWVkZmY1NTc3
15
- YzdmODJhNDc1ZmEyYTMxMWJiNTIyMmYxN2NkNGIyMjM5NDkzNzY=
13
+ NDcwOTk1OGJjNjFiZWY4YjlkZmVjOTk1NWFmNGI5OTU2NDgxNGY3ZGRlMjc0
14
+ NjA3ZWYwZTYwOTgyZWY4MGE4MTlhZmMyMjM3NGQzODJhMzA2YjcwY2M5MjI1
15
+ OWZlOTg1OWQ2NDhlYWZhYjFiZWEyNGE2NzdlYjhhMGJkM2FkMDM=
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.5.1**.
7
+ The latest version of this gem bundles **Dropzone v3.5.3**.
8
8
 
9
9
  ## Installation and usage
10
10
 
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.4.3'
3
- DROPZONE_VERSION = '3.5.1'
2
+ VERSION = '0.4.4'
3
+ DROPZONE_VERSION = '3.5.3'
4
4
  end
@@ -423,6 +423,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
423
423
  thumbnailHeight: 100,
424
424
  params: {},
425
425
  clickable: true,
426
+ ignoreHiddenFiles: true,
426
427
  acceptedMimeTypes: null,
427
428
  acceptParameter: null,
428
429
  enqueueForUpload: true,
@@ -825,8 +826,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
825
826
  this.removeAllFiles(true);
826
827
  if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) {
827
828
  this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
828
- return this.hiddenFileInput = null;
829
+ this.hiddenFileInput = null;
829
830
  }
831
+ return delete this.element.dropzone;
830
832
  };
831
833
 
832
834
  Dropzone.prototype.updateTotalUploadProgress = function() {
@@ -973,14 +975,19 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
973
975
  };
974
976
 
975
977
  Dropzone.prototype.drop = function(e) {
976
- var files;
978
+ var files, items;
977
979
  if (!e.dataTransfer) {
978
980
  return;
979
981
  }
980
982
  files = e.dataTransfer.files;
981
983
  this.emit("selectedfiles", files);
982
984
  if (files.length) {
983
- return this.handleFiles(files);
985
+ items = e.dataTransfer.items;
986
+ if (items && items.length && ((items[0].webkitGetAsEntry != null) || (items[0].getAsEntry != null))) {
987
+ this.handleItems(items);
988
+ } else {
989
+ this.handleFiles(files);
990
+ }
984
991
  }
985
992
  };
986
993
 
@@ -994,6 +1001,23 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
994
1001
  return _results;
995
1002
  };
996
1003
 
1004
+ Dropzone.prototype.handleItems = function(items) {
1005
+ var entry, item, _i, _len;
1006
+ for (_i = 0, _len = items.length; _i < _len; _i++) {
1007
+ item = items[_i];
1008
+ if (item.webkitGetAsEntry != null) {
1009
+ entry = item.webkitGetAsEntry();
1010
+ if (entry.isFile) {
1011
+ this.addFile(item.getAsFile());
1012
+ } else if (entry.isDirectory) {
1013
+ this.addDirectory(entry, entry.name);
1014
+ }
1015
+ } else {
1016
+ this.addFile(item.getAsFile());
1017
+ }
1018
+ }
1019
+ };
1020
+
997
1021
  Dropzone.prototype.accept = function(file, done) {
998
1022
  if (file.size > this.options.maxFilesize * 1024 * 1024) {
999
1023
  return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
@@ -1032,6 +1056,32 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1032
1056
  });
1033
1057
  };
1034
1058
 
1059
+ Dropzone.prototype.addDirectory = function(entry, path) {
1060
+ var dirReader, entriesReader,
1061
+ _this = this;
1062
+ dirReader = entry.createReader();
1063
+ entriesReader = function(entries) {
1064
+ var _i, _len;
1065
+ for (_i = 0, _len = entries.length; _i < _len; _i++) {
1066
+ entry = entries[_i];
1067
+ if (entry.isFile) {
1068
+ entry.file(function(file) {
1069
+ if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
1070
+ return;
1071
+ }
1072
+ file.fullPath = "" + path + "/" + file.name;
1073
+ return _this.addFile(file);
1074
+ });
1075
+ } else if (entry.isDirectory) {
1076
+ _this.addDirectory(entry, "" + path + "/" + entry.name);
1077
+ }
1078
+ }
1079
+ };
1080
+ return dirReader.readEntries(entriesReader, function(error) {
1081
+ return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
1082
+ });
1083
+ };
1084
+
1035
1085
  Dropzone.prototype.removeFile = function(file) {
1036
1086
  if (file.status === Dropzone.UPLOADING) {
1037
1087
  this.cancelUpload(file);
@@ -1128,8 +1178,8 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1128
1178
  _this = this;
1129
1179
  xhr = new XMLHttpRequest();
1130
1180
  file.xhr = xhr;
1131
- xhr.withCredentials = !!this.options.withCredentials;
1132
1181
  xhr.open(this.options.method, this.options.url, true);
1182
+ xhr.withCredentials = !!this.options.withCredentials;
1133
1183
  response = null;
1134
1184
  handleError = function() {
1135
1185
  return _this.errorProcessing(file, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
@@ -1241,7 +1291,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
1241
1291
 
1242
1292
  })(Em);
1243
1293
 
1244
- Dropzone.version = "3.5.1";
1294
+ Dropzone.version = "3.5.3";
1245
1295
 
1246
1296
  Dropzone.options = {};
1247
1297
 
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.3
4
+ version: 0.4.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-06-23 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit