dropzonejs-rails 0.7.0 → 0.7.1

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: a73ec47cb1d0f54c8b345cf59ccd44bfdc0be776
4
- data.tar.gz: 3deb54b4acc966d133284a5f87310ca750cb4543
3
+ metadata.gz: 56a0173ec08b69509951bf1e974c2f86fcd743f9
4
+ data.tar.gz: 02ddfe7c21416d3ab877a1cc0109d74efd09efd8
5
5
  SHA512:
6
- metadata.gz: 1912186764bf9b5131794f51e6738020ecc2e8c23172ac51d494e5f30fa56c0d275e2fa4955a000c417a5333690cc46d4fbd28a3fb9868c3a2cb510d88f2b4f3
7
- data.tar.gz: a82d54a6cf70f01ee29b49b08f7f0c699ec77d2d4e525f64e6b979e989cb3ada9168a22d622c38657edf6033896691815ef44b6fbb4b6b732cfdb0e1f6638e1d
6
+ metadata.gz: f1755eb86e2a085d79eef80abbc734ba48371781c644f6cf0843fedb0f7ba26eab8f82aadbccbcdab78ccb92a1121be37a6edce5b23bffd1c1faf0a089439b4b
7
+ data.tar.gz: bfe492d67b1156463c23cbc3ea9195c80a8e9546a534c737c87f7c68a8b9e01b2a0749feda45d499de595502d667701b71b3ee05d335ee87f7ea3eaf63d4e6b8
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.0.0**.
7
+ The latest version of this gem bundles **Dropzone v4.0.1**.
8
8
 
9
9
  ### Dropzone 3.x
10
10
 
@@ -1054,7 +1054,6 @@
1054
1054
  fileReader = new FileReader;
1055
1055
  fileReader.onload = (function(_this) {
1056
1056
  return function() {
1057
- var img;
1058
1057
  if (file.type === "image/svg+xml") {
1059
1058
  _this.emit("thumbnail", file, fileReader.result);
1060
1059
  if (callback != null) {
@@ -1062,36 +1061,45 @@
1062
1061
  }
1063
1062
  return;
1064
1063
  }
1065
- img = document.createElement("img");
1066
- img.onload = function() {
1067
- var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
1068
- file.width = img.width;
1069
- file.height = img.height;
1070
- resizeInfo = _this.options.resize.call(_this, file);
1071
- if (resizeInfo.trgWidth == null) {
1072
- resizeInfo.trgWidth = resizeInfo.optWidth;
1073
- }
1074
- if (resizeInfo.trgHeight == null) {
1075
- resizeInfo.trgHeight = resizeInfo.optHeight;
1076
- }
1077
- canvas = document.createElement("canvas");
1078
- ctx = canvas.getContext("2d");
1079
- canvas.width = resizeInfo.trgWidth;
1080
- canvas.height = resizeInfo.trgHeight;
1081
- drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
1082
- thumbnail = canvas.toDataURL("image/png");
1083
- _this.emit("thumbnail", file, thumbnail);
1084
- if (callback != null) {
1085
- return callback();
1086
- }
1087
- };
1088
- img.onerror = callback;
1089
- return img.src = fileReader.result;
1064
+ return _this.createThumbnailFromUrl(file, fileReader.result, callback);
1090
1065
  };
1091
1066
  })(this);
1092
1067
  return fileReader.readAsDataURL(file);
1093
1068
  };
1094
1069
 
1070
+ Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback) {
1071
+ var img;
1072
+ img = document.createElement("img");
1073
+ img.onload = (function(_this) {
1074
+ return function() {
1075
+ var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
1076
+ file.width = img.width;
1077
+ file.height = img.height;
1078
+ resizeInfo = _this.options.resize.call(_this, file);
1079
+ if (resizeInfo.trgWidth == null) {
1080
+ resizeInfo.trgWidth = resizeInfo.optWidth;
1081
+ }
1082
+ if (resizeInfo.trgHeight == null) {
1083
+ resizeInfo.trgHeight = resizeInfo.optHeight;
1084
+ }
1085
+ canvas = document.createElement("canvas");
1086
+ ctx = canvas.getContext("2d");
1087
+ canvas.width = resizeInfo.trgWidth;
1088
+ canvas.height = resizeInfo.trgHeight;
1089
+ drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
1090
+ thumbnail = canvas.toDataURL("image/png");
1091
+ _this.emit("thumbnail", file, thumbnail);
1092
+ if (callback != null) {
1093
+ return callback();
1094
+ }
1095
+ };
1096
+ })(this);
1097
+ if (callback != null) {
1098
+ img.onerror = callback;
1099
+ }
1100
+ return img.src = imageUrl;
1101
+ };
1102
+
1095
1103
  Dropzone.prototype.processQueue = function() {
1096
1104
  var i, parallelUploads, processingLength, queuedFiles;
1097
1105
  parallelUploads = this.options.parallelUploads;
@@ -1377,7 +1385,7 @@
1377
1385
 
1378
1386
  })(Emitter);
1379
1387
 
1380
- Dropzone.version = "4.0.0";
1388
+ Dropzone.version = "4.0.1";
1381
1389
 
1382
1390
  Dropzone.options = {};
1383
1391
 
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.7.0'
3
- DROPZONE_VERSION = '4.0.0'
2
+ VERSION = '0.7.1'
3
+ DROPZONE_VERSION = '4.0.1'
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.0
4
+ version: 0.7.1
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-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit