dropzonejs-rails 0.5.2 → 0.5.3

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: d506ee623940ef72c0e5c72f89f27bb333eafa30
4
- data.tar.gz: f61b4e37d5bbec097f65384463d3479ac7f87f9f
3
+ metadata.gz: 5b564afaefa616ea05e4048f2d27bab01c3a1a59
4
+ data.tar.gz: 0e1ad197e1f78a8a6829ec70f19c7ca8b7dcec3e
5
5
  SHA512:
6
- metadata.gz: fa0c259f6208ed5747f4210a789abe2ceb39df6a424dbcb29e64fdec9f56db8a343d811b9ab7f04b52b8afaabc3036c22416640e040e2df1f9fb7050d7f25a68
7
- data.tar.gz: 0e27b3a83b81abe845f978cf0207d84cbd045c6fec36787a1a1ae1879f5c0043488ae8d948e0e9bc588f9fd524fe753252c572edd7da79e823a95468301e57e2
6
+ metadata.gz: dd6e2bbcf7700d07fa404573d6ab8f89fca197d9a68c02dc24642e711eb2e05456b518b6eec4e91e2eef29f3f26a93d7553d2ba0bd07730198139823298a2dd1
7
+ data.tar.gz: b163448d07c9c0563ab306eb17bdb3d45222b98b6c592555db03d52ec394aebd082e7857a8d183cbd5a286c33b176473020dc0c0d72ea74621368edf104c9f0d
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.11.1**.
7
+ The latest version of this gem bundles **Dropzone v3.12.0**.
8
8
 
9
9
  ## Installation and usage
10
10
 
@@ -22,89 +22,6 @@ function require(name) {
22
22
  return module.exports;
23
23
  }
24
24
 
25
- /**
26
- * Meta info, accessible in the global scope unless you use AMD option.
27
- */
28
-
29
- require.loader = 'component';
30
-
31
- /**
32
- * Internal helper object, contains a sorting function for semantiv versioning
33
- */
34
- require.helper = {};
35
- require.helper.semVerSort = function(a, b) {
36
- var aArray = a.version.split('.');
37
- var bArray = b.version.split('.');
38
- for (var i=0; i<aArray.length; ++i) {
39
- var aInt = parseInt(aArray[i], 10);
40
- var bInt = parseInt(bArray[i], 10);
41
- if (aInt === bInt) {
42
- var aLex = aArray[i].substr((""+aInt).length);
43
- var bLex = bArray[i].substr((""+bInt).length);
44
- if (aLex === '' && bLex !== '') return 1;
45
- if (aLex !== '' && bLex === '') return -1;
46
- if (aLex !== '' && bLex !== '') return aLex > bLex ? 1 : -1;
47
- continue;
48
- } else if (aInt > bInt) {
49
- return 1;
50
- } else {
51
- return -1;
52
- }
53
- }
54
- return 0;
55
- }
56
-
57
- /**
58
- * Find and require a module which name starts with the provided name.
59
- * If multiple modules exists, the highest semver is used.
60
- * This function can only be used for remote dependencies.
61
-
62
- * @param {String} name - module name: `user~repo`
63
- * @param {Boolean} returnPath - returns the canonical require path if true,
64
- * otherwise it returns the epxorted module
65
- */
66
- require.latest = function (name, returnPath) {
67
- function showError(name) {
68
- throw new Error('failed to find latest module of "' + name + '"');
69
- }
70
- // only remotes with semvers, ignore local files conataining a '/'
71
- var versionRegexp = /(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;
72
- var remoteRegexp = /(.*)~(.*)/;
73
- if (!remoteRegexp.test(name)) showError(name);
74
- var moduleNames = Object.keys(require.modules);
75
- var semVerCandidates = [];
76
- var otherCandidates = []; // for instance: name of the git branch
77
- for (var i=0; i<moduleNames.length; i++) {
78
- var moduleName = moduleNames[i];
79
- if (new RegExp(name + '@').test(moduleName)) {
80
- var version = moduleName.substr(name.length+1);
81
- var semVerMatch = versionRegexp.exec(moduleName);
82
- if (semVerMatch != null) {
83
- semVerCandidates.push({version: version, name: moduleName});
84
- } else {
85
- otherCandidates.push({version: version, name: moduleName});
86
- }
87
- }
88
- }
89
- if (semVerCandidates.concat(otherCandidates).length === 0) {
90
- showError(name);
91
- }
92
- if (semVerCandidates.length > 0) {
93
- var module = semVerCandidates.sort(require.helper.semVerSort).pop().name;
94
- if (returnPath === true) {
95
- return module;
96
- }
97
- return require(module);
98
- }
99
- // if the build contains more than one branch of the same module
100
- // you should not use this funciton
101
- var module = otherCandidates.pop().name;
102
- if (returnPath === true) {
103
- return module;
104
- }
105
- return require(module);
106
- }
107
-
108
25
  /**
109
26
  * Registered modules.
110
27
  */
@@ -138,174 +55,6 @@ require.define = function (name, exports) {
138
55
  exports: exports
139
56
  };
140
57
  };
141
- require.register("component~emitter@1.1.2", function (exports, module) {
142
-
143
- /**
144
- * Expose `Emitter`.
145
- */
146
-
147
- module.exports = Emitter;
148
-
149
- /**
150
- * Initialize a new `Emitter`.
151
- *
152
- * @api public
153
- */
154
-
155
- function Emitter(obj) {
156
- if (obj) return mixin(obj);
157
- };
158
-
159
- /**
160
- * Mixin the emitter properties.
161
- *
162
- * @param {Object} obj
163
- * @return {Object}
164
- * @api private
165
- */
166
-
167
- function mixin(obj) {
168
- for (var key in Emitter.prototype) {
169
- obj[key] = Emitter.prototype[key];
170
- }
171
- return obj;
172
- }
173
-
174
- /**
175
- * Listen on the given `event` with `fn`.
176
- *
177
- * @param {String} event
178
- * @param {Function} fn
179
- * @return {Emitter}
180
- * @api public
181
- */
182
-
183
- Emitter.prototype.on =
184
- Emitter.prototype.addEventListener = function(event, fn){
185
- this._callbacks = this._callbacks || {};
186
- (this._callbacks[event] = this._callbacks[event] || [])
187
- .push(fn);
188
- return this;
189
- };
190
-
191
- /**
192
- * Adds an `event` listener that will be invoked a single
193
- * time then automatically removed.
194
- *
195
- * @param {String} event
196
- * @param {Function} fn
197
- * @return {Emitter}
198
- * @api public
199
- */
200
-
201
- Emitter.prototype.once = function(event, fn){
202
- var self = this;
203
- this._callbacks = this._callbacks || {};
204
-
205
- function on() {
206
- self.off(event, on);
207
- fn.apply(this, arguments);
208
- }
209
-
210
- on.fn = fn;
211
- this.on(event, on);
212
- return this;
213
- };
214
-
215
- /**
216
- * Remove the given callback for `event` or all
217
- * registered callbacks.
218
- *
219
- * @param {String} event
220
- * @param {Function} fn
221
- * @return {Emitter}
222
- * @api public
223
- */
224
-
225
- Emitter.prototype.off =
226
- Emitter.prototype.removeListener =
227
- Emitter.prototype.removeAllListeners =
228
- Emitter.prototype.removeEventListener = function(event, fn){
229
- this._callbacks = this._callbacks || {};
230
-
231
- // all
232
- if (0 == arguments.length) {
233
- this._callbacks = {};
234
- return this;
235
- }
236
-
237
- // specific event
238
- var callbacks = this._callbacks[event];
239
- if (!callbacks) return this;
240
-
241
- // remove all handlers
242
- if (1 == arguments.length) {
243
- delete this._callbacks[event];
244
- return this;
245
- }
246
-
247
- // remove specific handler
248
- var cb;
249
- for (var i = 0; i < callbacks.length; i++) {
250
- cb = callbacks[i];
251
- if (cb === fn || cb.fn === fn) {
252
- callbacks.splice(i, 1);
253
- break;
254
- }
255
- }
256
- return this;
257
- };
258
-
259
- /**
260
- * Emit `event` with the given args.
261
- *
262
- * @param {String} event
263
- * @param {Mixed} ...
264
- * @return {Emitter}
265
- */
266
-
267
- Emitter.prototype.emit = function(event){
268
- this._callbacks = this._callbacks || {};
269
- var args = [].slice.call(arguments, 1)
270
- , callbacks = this._callbacks[event];
271
-
272
- if (callbacks) {
273
- callbacks = callbacks.slice(0);
274
- for (var i = 0, len = callbacks.length; i < len; ++i) {
275
- callbacks[i].apply(this, args);
276
- }
277
- }
278
-
279
- return this;
280
- };
281
-
282
- /**
283
- * Return array of callbacks for `event`.
284
- *
285
- * @param {String} event
286
- * @return {Array}
287
- * @api public
288
- */
289
-
290
- Emitter.prototype.listeners = function(event){
291
- this._callbacks = this._callbacks || {};
292
- return this._callbacks[event] || [];
293
- };
294
-
295
- /**
296
- * Check if this emitter has `event` handlers.
297
- *
298
- * @param {String} event
299
- * @return {Boolean}
300
- * @api public
301
- */
302
-
303
- Emitter.prototype.hasListeners = function(event){
304
- return !! this.listeners(event).length;
305
- };
306
-
307
- });
308
-
309
58
  require.register("dropzone", function (exports, module) {
310
59
 
311
60
 
@@ -345,20 +94,82 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
345
94
  */
346
95
 
347
96
  (function() {
348
- var Dropzone, Em, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
97
+ var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
98
+ __slice = [].slice,
349
99
  __hasProp = {}.hasOwnProperty,
350
- __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; },
351
- __slice = [].slice;
352
-
353
- Em = typeof Emitter !== "undefined" && Emitter !== null ? Emitter : require("component~emitter@1.1.2");
100
+ __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; };
354
101
 
355
102
  noop = function() {};
356
103
 
104
+ Emitter = (function() {
105
+ function Emitter() {}
106
+
107
+ Emitter.prototype.addEventListener = Emitter.prototype.on;
108
+
109
+ Emitter.prototype.on = function(event, fn) {
110
+ this._callbacks = this._callbacks || {};
111
+ if (!this._callbacks[event]) {
112
+ this._callbacks[event] = [];
113
+ }
114
+ this._callbacks[event].push(fn);
115
+ return this;
116
+ };
117
+
118
+ Emitter.prototype.emit = function() {
119
+ var args, callback, callbacks, event, _i, _len;
120
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
121
+ this._callbacks = this._callbacks || {};
122
+ callbacks = this._callbacks[event];
123
+ if (callbacks) {
124
+ for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
125
+ callback = callbacks[_i];
126
+ callback.apply(this, args);
127
+ }
128
+ }
129
+ return this;
130
+ };
131
+
132
+ Emitter.prototype.removeListener = Emitter.prototype.off;
133
+
134
+ Emitter.prototype.removeAllListeners = Emitter.prototype.off;
135
+
136
+ Emitter.prototype.removeEventListener = Emitter.prototype.off;
137
+
138
+ Emitter.prototype.off = function(event, fn) {
139
+ var callback, callbacks, i, _i, _len;
140
+ if (!this._callbacks || arguments.length === 0) {
141
+ this._callbacks = {};
142
+ return this;
143
+ }
144
+ callbacks = this._callbacks[event];
145
+ if (!callbacks) {
146
+ return this;
147
+ }
148
+ if (arguments.length === 1) {
149
+ delete this._callbacks[event];
150
+ return this;
151
+ }
152
+ for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {
153
+ callback = callbacks[i];
154
+ if (callback === fn) {
155
+ callbacks.splice(i, 1);
156
+ break;
157
+ }
158
+ }
159
+ return this;
160
+ };
161
+
162
+ return Emitter;
163
+
164
+ })();
165
+
357
166
  Dropzone = (function(_super) {
358
- var extend;
167
+ var extend, resolveOption;
359
168
 
360
169
  __extends(Dropzone, _super);
361
170
 
171
+ Dropzone.prototype.Emitter = Emitter;
172
+
362
173
 
363
174
  /*
364
175
  This is a list of all available events you can register on a dropzone object.
@@ -368,7 +179,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
368
179
  dropzone.on("dragEnter", function() { });
369
180
  */
370
181
 
371
- Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached"];
182
+ Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
372
183
 
373
184
  Dropzone.prototype.defaultOptions = {
374
185
  url: null,
@@ -636,6 +447,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
636
447
  completemultiple: noop,
637
448
  maxfilesexceeded: noop,
638
449
  maxfilesreached: noop,
450
+ queuecomplete: noop,
639
451
  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>"
640
452
  };
641
453
 
@@ -1431,18 +1243,29 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
1431
1243
  }
1432
1244
  };
1433
1245
 
1246
+ resolveOption = function() {
1247
+ var args, option;
1248
+ option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
1249
+ if (typeof option === 'function') {
1250
+ return option.apply(this, args);
1251
+ }
1252
+ return option;
1253
+ };
1254
+
1434
1255
  Dropzone.prototype.uploadFile = function(file) {
1435
1256
  return this.uploadFiles([file]);
1436
1257
  };
1437
1258
 
1438
1259
  Dropzone.prototype.uploadFiles = function(files) {
1439
- var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, option, progressObj, response, updateProgress, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
1260
+ var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, method, option, progressObj, response, updateProgress, url, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
1440
1261
  xhr = new XMLHttpRequest();
1441
1262
  for (_i = 0, _len = files.length; _i < _len; _i++) {
1442
1263
  file = files[_i];
1443
1264
  file.xhr = xhr;
1444
1265
  }
1445
- xhr.open(this.options.method, this.options.url, true);
1266
+ method = resolveOption(this.options.method, files);
1267
+ url = resolveOption(this.options.url, files);
1268
+ xhr.open(method, url, true);
1446
1269
  xhr.withCredentials = !!this.options.withCredentials;
1447
1270
  response = null;
1448
1271
  handleError = (function(_this) {
@@ -1616,9 +1439,9 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
1616
1439
 
1617
1440
  return Dropzone;
1618
1441
 
1619
- })(Em);
1442
+ })(Emitter);
1620
1443
 
1621
- Dropzone.version = "3.11.1";
1444
+ Dropzone.version = "3.12.0";
1622
1445
 
1623
1446
  Dropzone.options = {};
1624
1447
 
@@ -1965,8 +1788,8 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
1965
1788
  if (typeof exports == "object") {
1966
1789
  module.exports = require("dropzone");
1967
1790
  } else if (typeof define == "function" && define.amd) {
1968
- define("Dropzone", [], function(){ return require("dropzone"); });
1791
+ define([], function(){ return require("dropzone"); });
1969
1792
  } else {
1970
- (this || window)["Dropzone"] = require("dropzone");
1793
+ this["Dropzone"] = require("dropzone");
1971
1794
  }
1972
1795
  })()
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.5.2'
3
- DROPZONE_VERSION = '3.11.1'
2
+ VERSION = '0.5.3'
3
+ DROPZONE_VERSION = '3.12.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.5.2
4
+ version: 0.5.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: 2014-11-25 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.4.2
94
+ rubygems_version: 2.4.5
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Integrates Dropzone JS File upload into Rails Asset pipeline.