dropzonejs-rails 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/lib/dropzonejs-rails/version.rb +2 -2
- data/vendor/assets/javascripts/dropzone.js +54 -17
- data/vendor/assets/stylesheets/dropzone/dropzone.css.scss +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzkxOTExMWY3OTFlYWY2NmNmODg0ZDYyYTY0NWM0Zjc4YTQ5YWQ1NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjhjN2Q5MTdhOGNhMjNkN2EzYjkzMmQxZmRiOGQzNzI4ODM3MTM2MQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTQ4YTEyODM2YjNlYTE0ZmJjYTUzMzAxNjdjMjU2NzZlODYxYzE3MGEzYjIz
|
10
|
+
YTViZDM5NmVjMzY2MGUxNDNhOGZhNGE0MWY5M2ZjZjBlNjE3NDM3NjEyYjIw
|
11
|
+
MDQ1NjNjMDY4MWYwOWUxNTJmYjc1ZTg3ZDNhYjQ5M2VkNDJhMTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTY3MzI1YjAxZWZmMzRmY2MwNmNhZmYxY2JiOWNhMjU3NzViZTdlYmExOWU1
|
14
|
+
ODUxNjEyYjEwNzYwZWY1YmNhMzY1OGY3ZTEwYzExY2JjYzgwNWU5YjhjMzQ4
|
15
|
+
MWQ4OGU0NDcxNDRiYTY4OGQwZjA4ODI4M2RlN2Q3YjMwODQ4YzY=
|
data/README.md
CHANGED
@@ -432,13 +432,19 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
432
432
|
thumbnailHeight: 100,
|
433
433
|
params: {},
|
434
434
|
clickable: true,
|
435
|
+
acceptedMimeTypes: null,
|
435
436
|
acceptParameter: null,
|
436
437
|
enqueueForUpload: true,
|
437
438
|
previewsContainer: null,
|
438
439
|
dictDefaultMessage: "Drop files here to upload",
|
439
440
|
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
|
440
441
|
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
|
442
|
+
dictInvalidFileType: "You can't upload files of this type.",
|
443
|
+
dictResponseError: "Server responded with {{statusCode}} code.",
|
441
444
|
accept: function(file, done) {
|
445
|
+
if (!Dropzone.isValidMimeType(file.type, this.options.acceptedMimeTypes)) {
|
446
|
+
return done(this.options.dictInvalidFileType);
|
447
|
+
}
|
442
448
|
return done();
|
443
449
|
},
|
444
450
|
init: function() {
|
@@ -502,32 +508,33 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
502
508
|
return this.element.classList.remove("started");
|
503
509
|
},
|
504
510
|
addedfile: function(file) {
|
505
|
-
file.
|
506
|
-
|
507
|
-
|
508
|
-
|
511
|
+
file.previewElement = Dropzone.createElement(this.options.previewTemplate);
|
512
|
+
file.previewTemplate = file.previewElement;
|
513
|
+
this.previewsContainer.appendChild(file.previewElement);
|
514
|
+
file.previewElement.querySelector(".filename span").textContent = file.name;
|
515
|
+
return file.previewElement.querySelector(".details").appendChild(Dropzone.createElement("<div class=\"size\">" + (this.filesize(file.size)) + "</div>"));
|
509
516
|
},
|
510
517
|
removedfile: function(file) {
|
511
|
-
return file.
|
518
|
+
return file.previewElement.parentNode.removeChild(file.previewElement);
|
512
519
|
},
|
513
520
|
thumbnail: function(file, dataUrl) {
|
514
|
-
file.
|
515
|
-
file.
|
516
|
-
return file.
|
521
|
+
file.previewElement.classList.remove("file-preview");
|
522
|
+
file.previewElement.classList.add("image-preview");
|
523
|
+
return file.previewElement.querySelector(".details").appendChild(Dropzone.createElement("<img alt=\"" + file.name + "\" src=\"" + dataUrl + "\"/>"));
|
517
524
|
},
|
518
525
|
error: function(file, message) {
|
519
|
-
file.
|
520
|
-
return file.
|
526
|
+
file.previewElement.classList.add("error");
|
527
|
+
return file.previewElement.querySelector(".error-message span").textContent = message;
|
521
528
|
},
|
522
529
|
processingfile: function(file) {
|
523
|
-
return file.
|
530
|
+
return file.previewElement.classList.add("processing");
|
524
531
|
},
|
525
532
|
uploadprogress: function(file, progress, bytesSent) {
|
526
|
-
return file.
|
533
|
+
return file.previewElement.querySelector(".progress .upload").style.width = "" + progress + "%";
|
527
534
|
},
|
528
535
|
sending: noop,
|
529
536
|
success: function(file) {
|
530
|
-
return file.
|
537
|
+
return file.previewElement.classList.add("success");
|
531
538
|
},
|
532
539
|
complete: noop,
|
533
540
|
previewTemplate: "<div class=\"preview file-preview\">\n <div class=\"details\">\n <div class=\"filename\"><span></span></div>\n </div>\n <div class=\"progress\"><span class=\"upload\"></span></div>\n <div class=\"success-mark\"><span>✔</span></div>\n <div class=\"error-mark\"><span>✘</span></div>\n <div class=\"error-message\"><span></span></div>\n</div>"
|
@@ -571,6 +578,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
571
578
|
if (!this.options.url) {
|
572
579
|
throw new Error("No URL provided.");
|
573
580
|
}
|
581
|
+
if (this.options.acceptParameter && this.options.acceptedMimeTypes) {
|
582
|
+
throw new Error("You can't provide both 'acceptParameter' and 'acceptedMimeTypes'. 'acceptParameter' is deprecated.");
|
583
|
+
}
|
574
584
|
this.options.method = this.options.method.toUpperCase();
|
575
585
|
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
|
576
586
|
return this.options.fallback.call(this);
|
@@ -623,6 +633,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
623
633
|
_this.hiddenFileInput = document.createElement("input");
|
624
634
|
_this.hiddenFileInput.setAttribute("type", "file");
|
625
635
|
_this.hiddenFileInput.setAttribute("multiple", "multiple");
|
636
|
+
if (_this.options.acceptedMimeTypes != null) {
|
637
|
+
_this.hiddenFileInput.setAttribute("accept", _this.options.acceptedMimeTypes);
|
638
|
+
}
|
626
639
|
if (_this.options.acceptParameter != null) {
|
627
640
|
_this.hiddenFileInput.setAttribute("accept", _this.options.acceptParameter);
|
628
641
|
}
|
@@ -988,7 +1001,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
988
1001
|
xhr = new XMLHttpRequest();
|
989
1002
|
xhr.open(this.options.method, this.options.url, true);
|
990
1003
|
handleError = function() {
|
991
|
-
return _this.errorProcessing(file, xhr.responseText || ("
|
1004
|
+
return _this.errorProcessing(file, xhr.responseText || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
|
992
1005
|
};
|
993
1006
|
xhr.onload = function(e) {
|
994
1007
|
var response, _ref;
|
@@ -1048,11 +1061,11 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1048
1061
|
return this.emit("complete", file);
|
1049
1062
|
};
|
1050
1063
|
|
1051
|
-
Dropzone.prototype.errorProcessing = function(file, message) {
|
1064
|
+
Dropzone.prototype.errorProcessing = function(file, message, xhr) {
|
1052
1065
|
this.filesProcessing = without(this.filesProcessing, file);
|
1053
1066
|
file.processing = false;
|
1054
1067
|
this.processQueue();
|
1055
|
-
this.emit("error", file, message);
|
1068
|
+
this.emit("error", file, message, xhr);
|
1056
1069
|
return this.emit("complete", file);
|
1057
1070
|
};
|
1058
1071
|
|
@@ -1060,7 +1073,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1060
1073
|
|
1061
1074
|
})(Em);
|
1062
1075
|
|
1063
|
-
Dropzone.version = "2.0.
|
1076
|
+
Dropzone.version = "2.0.16";
|
1064
1077
|
|
1065
1078
|
Dropzone.options = {};
|
1066
1079
|
|
@@ -1188,6 +1201,30 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1188
1201
|
return false;
|
1189
1202
|
};
|
1190
1203
|
|
1204
|
+
Dropzone.isValidMimeType = function(mimeType, acceptedMimeTypes) {
|
1205
|
+
var baseMimeType, validMimeType, _i, _len;
|
1206
|
+
|
1207
|
+
if (!acceptedMimeTypes) {
|
1208
|
+
return true;
|
1209
|
+
}
|
1210
|
+
acceptedMimeTypes = acceptedMimeTypes.split(",");
|
1211
|
+
baseMimeType = mimeType.replace(/\/.*$/, "");
|
1212
|
+
for (_i = 0, _len = acceptedMimeTypes.length; _i < _len; _i++) {
|
1213
|
+
validMimeType = acceptedMimeTypes[_i];
|
1214
|
+
validMimeType = validMimeType.trim();
|
1215
|
+
if (/\/\*$/.test(validMimeType)) {
|
1216
|
+
if (baseMimeType === validMimeType.replace(/\/.*$/, "")) {
|
1217
|
+
return true;
|
1218
|
+
}
|
1219
|
+
} else {
|
1220
|
+
if (mimeType === validMimeType) {
|
1221
|
+
return true;
|
1222
|
+
}
|
1223
|
+
}
|
1224
|
+
}
|
1225
|
+
return false;
|
1226
|
+
};
|
1227
|
+
|
1191
1228
|
if (typeof jQuery !== "undefined" && jQuery !== null) {
|
1192
1229
|
jQuery.fn.dropzone = function(options) {
|
1193
1230
|
return this.each(function() {
|
@@ -171,7 +171,7 @@
|
|
171
171
|
-o-transition: opacity 0.3s ease-in-out;
|
172
172
|
-ms-transition: opacity 0.3s ease-in-out;
|
173
173
|
transition: opacity 0.3s ease-in-out;
|
174
|
-
background-image: image-
|
174
|
+
background-image: image-path("dropzone/spritemap.png");
|
175
175
|
background-repeat: no-repeat;
|
176
176
|
background-position: 0 0;
|
177
177
|
position: absolute;
|
@@ -184,7 +184,7 @@
|
|
184
184
|
}
|
185
185
|
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
|
186
186
|
.dropzone .default.message {
|
187
|
-
background-image: image-
|
187
|
+
background-image: image-path("dropzone/spritemap@2x.png");
|
188
188
|
-webkit-background-size: 428px 406px;
|
189
189
|
-moz-background-size: 428px 406px;
|
190
190
|
background-size: 428px 406px;
|
@@ -258,7 +258,7 @@
|
|
258
258
|
-o-transition: opacity 0.4s ease-in-out;
|
259
259
|
-ms-transition: opacity 0.4s ease-in-out;
|
260
260
|
transition: opacity 0.4s ease-in-out;
|
261
|
-
background-image: image-
|
261
|
+
background-image: image-path("dropzone/spritemap.png");
|
262
262
|
background-repeat: no-repeat;
|
263
263
|
}
|
264
264
|
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
|
@@ -266,7 +266,7 @@
|
|
266
266
|
.dropzone-previews .preview .error-mark,
|
267
267
|
.dropzone .preview .success-mark,
|
268
268
|
.dropzone-previews .preview .success-mark {
|
269
|
-
background-image: image-
|
269
|
+
background-image: image-path("dropzone/spritemap@2x.png");
|
270
270
|
-webkit-background-size: 428px 406px;
|
271
271
|
-moz-background-size: 428px 406px;
|
272
272
|
background-size: 428px 406px;
|
@@ -305,14 +305,14 @@
|
|
305
305
|
left: 0;
|
306
306
|
width: 0%;
|
307
307
|
height: 100%;
|
308
|
-
background-image: image-
|
308
|
+
background-image: image-path("dropzone/spritemap.png");
|
309
309
|
background-repeat: repeat-x;
|
310
310
|
background-position: 0px -400px;
|
311
311
|
}
|
312
312
|
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
|
313
313
|
.dropzone .preview .progress .upload,
|
314
314
|
.dropzone-previews .preview .progress .upload {
|
315
|
-
background-image: image-
|
315
|
+
background-image: image-path("dropzone/spritemap@2x.png");
|
316
316
|
-webkit-background-size: 428px 406px;
|
317
317
|
-moz-background-size: 428px 406px;
|
318
318
|
background-size: 428px 406px;
|
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.2.
|
4
|
+
version: 0.2.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: 2013-05-
|
11
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|