dropzonejs-rails 0.7.2 → 0.7.3

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c040bfdcb98b7e16531d426e4880f2372765256d
4
- data.tar.gz: dcc2d26ec689cbccb794891544e294ea85c489e3
3
+ metadata.gz: 77a0fb4b3f5c8df7947083e69782c94f2e705cbf
4
+ data.tar.gz: 93f9d5ae12060688ce4c0c089af11e004ffd932d
5
5
  SHA512:
6
- metadata.gz: 18c8dfc08cfbc8fec8486a0900173f8793572eef2bbdd7bf96fa2b4c11b87be147fcc7a306350f781b927dd7a1e93566d7c8c1005b77bfd9f1fc5fa8fab0dc34
7
- data.tar.gz: ec4aa40a72cd5fd42dad48b9e24f6504f8462a3ebbf3c4593dbbefda116f79caf5d741a5abf84444518ad4e92df3adf83aa75e7b641aedde8f251f76ea835960
6
+ metadata.gz: 2f949c8394b843ec2eec9d79d2333f01307cc39ff640d8df99ac5787d5b2e2683d31211e5f2325fc8200dec238614907934e124df28a0632125a1759fa64be8c
7
+ data.tar.gz: e78ff83a032b0f552e63be35b1314752cc0e7ff301d24ac3e86e58e39fcb0ff29aa5460201fa6663ec3ba1624d1066d94f80f3fc7778d0a8512f39d306083b0e
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 v4.2.0**.
7
+ The latest version of this gem bundles **Dropzone v4.3.0**.
8
8
 
9
9
  ### Dropzone 3.x
10
10
 
@@ -71,7 +71,7 @@ Go to [this secret place](https://github.com/ncuesta/dropzonejs-rails/issues).
71
71
 
72
72
  ## Licence (MIT)
73
73
 
74
- (c) Copyright 2013-2015 José Nahuel Cuesta Luengo
74
+ (c) Copyright 2013-2016 José Nahuel Cuesta Luengo
75
75
 
76
76
  Permission is hereby granted, free of charge, to any person obtaining
77
77
  a copy of this software and associated documentation files (the
@@ -138,6 +138,7 @@
138
138
  previewsContainer: null,
139
139
  hiddenInputContainer: "body",
140
140
  capture: null,
141
+ renameFilename: null,
141
142
  dictDefaultMessage: "Drop files here to upload",
142
143
  dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
143
144
  dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
@@ -259,7 +260,7 @@
259
260
  _ref = file.previewElement.querySelectorAll("[data-dz-name]");
260
261
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
261
262
  node = _ref[_i];
262
- node.textContent = file.name;
263
+ node.textContent = this._renameFilename(file.name);
263
264
  }
264
265
  _ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
265
266
  for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
@@ -720,6 +721,13 @@
720
721
  }
721
722
  };
722
723
 
724
+ Dropzone.prototype._renameFilename = function(name) {
725
+ if (typeof this.options.renameFilename !== "function") {
726
+ return name;
727
+ }
728
+ return this.options.renameFilename(name);
729
+ };
730
+
723
731
  Dropzone.prototype.getFallbackForm = function() {
724
732
  var existingFallback, fields, fieldsString, form;
725
733
  if (existingFallback = this.getExistingFallback()) {
@@ -921,30 +929,37 @@
921
929
  };
922
930
 
923
931
  Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
924
- var dirReader, entriesReader;
932
+ var dirReader, errorHandler, readEntries;
925
933
  dirReader = directory.createReader();
926
- entriesReader = (function(_this) {
927
- return function(entries) {
928
- var entry, _i, _len;
929
- for (_i = 0, _len = entries.length; _i < _len; _i++) {
930
- entry = entries[_i];
931
- if (entry.isFile) {
932
- entry.file(function(file) {
933
- if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
934
- return;
934
+ errorHandler = function(error) {
935
+ return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
936
+ };
937
+ readEntries = (function(_this) {
938
+ return function() {
939
+ return dirReader.readEntries(function(entries) {
940
+ var entry, _i, _len;
941
+ if (entries.length > 0) {
942
+ for (_i = 0, _len = entries.length; _i < _len; _i++) {
943
+ entry = entries[_i];
944
+ if (entry.isFile) {
945
+ entry.file(function(file) {
946
+ if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
947
+ return;
948
+ }
949
+ file.fullPath = "" + path + "/" + file.name;
950
+ return _this.addFile(file);
951
+ });
952
+ } else if (entry.isDirectory) {
953
+ _this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
935
954
  }
936
- file.fullPath = "" + path + "/" + file.name;
937
- return _this.addFile(file);
938
- });
939
- } else if (entry.isDirectory) {
940
- _this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
955
+ }
956
+ readEntries();
941
957
  }
942
- }
958
+ return null;
959
+ }, errorHandler);
943
960
  };
944
961
  })(this);
945
- return dirReader.readEntries(entriesReader, function(error) {
946
- return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
947
- });
962
+ return readEntries();
948
963
  };
949
964
 
950
965
  Dropzone.prototype.accept = function(file, done) {
@@ -1362,7 +1377,7 @@
1362
1377
  }
1363
1378
  }
1364
1379
  for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) {
1365
- formData.append(this._getParamName(i), files[i], files[i].name);
1380
+ formData.append(this._getParamName(i), files[i], this._renameFilename(files[i].name));
1366
1381
  }
1367
1382
  return this.submitRequest(xhr, formData, files);
1368
1383
  };
@@ -1409,7 +1424,7 @@
1409
1424
 
1410
1425
  })(Emitter);
1411
1426
 
1412
- Dropzone.version = "4.2.0";
1427
+ Dropzone.version = "4.3.0";
1413
1428
 
1414
1429
  Dropzone.options = {};
1415
1430
 
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.7.2'
3
- DROPZONE_VERSION = '4.2.0'
2
+ VERSION = '0.7.3'
3
+ DROPZONE_VERSION = '4.3.0'
4
4
  end
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.7.2
4
+ version: 0.7.3
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: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.4.8
92
+ rubygems_version: 2.5.2
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Integrates Dropzone JS File upload into Rails Asset pipeline.