dropzonejs-rails 0.4.7 → 0.4.8
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 +8 -8
- data/README.md +1 -1
- data/lib/dropzonejs-rails/version.rb +2 -2
- data/vendor/assets/javascripts/dropzone.js +39 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjExMGJlZTUwY2M1MTBmYTlhNDg2ZWE3ZmMxODM5MDNmYzMwY2JlOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWM5ODk0NDU4NGQ3NWJmNWYxY2M4ZWNjNTU3MDU5NDdmM2UyYjYxMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODVkNzJlMTQwN2JkZjUzZDA3NjZlMzI5ZjU3OWViZDNhYjYyMzcyYTk1Y2Vk
|
10
|
+
YmI5ZjEyMDViOTU0ZWI2NTkwZTc1NzNlNzFiN2ZmZGVhMGQ1M2FlZWJkOTQ4
|
11
|
+
OTlmOGRkZjNlN2ZjYWE1MTJhNjNmMDc4ZmI4MTJmMGM4MTFiMDk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmQ5YWY5ZDIwZDBiZTc1YTRiNzM1OTE2OGE5MjA5NjFiNDEzNmU4MDM1OWRk
|
14
|
+
N2VmY2U5ZDk4MjljZTJlNzU3NjIzN2MwYjI3MmUyN2UwZTA4YmY1NjFkMzUz
|
15
|
+
ZGFkMWJjMDY0ZDgxZDIzOTA5NWJmMTAwMGJmMTYzNTU3ZmI1ZjI=
|
data/README.md
CHANGED
@@ -408,7 +408,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
408
408
|
*/
|
409
409
|
|
410
410
|
|
411
|
-
Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "selectedfiles", "addedfile", "removedfile", "thumbnail", "error", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset"];
|
411
|
+
Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "selectedfiles", "addedfile", "removedfile", "thumbnail", "error", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded"];
|
412
412
|
|
413
413
|
Dropzone.prototype.defaultOptions = {
|
414
414
|
url: null,
|
@@ -422,6 +422,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
422
422
|
maxThumbnailFilesize: 10,
|
423
423
|
thumbnailWidth: 100,
|
424
424
|
thumbnailHeight: 100,
|
425
|
+
maxFiles: null,
|
425
426
|
params: {},
|
426
427
|
clickable: true,
|
427
428
|
ignoreHiddenFiles: true,
|
@@ -440,6 +441,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
440
441
|
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
|
441
442
|
dictRemoveFile: "Remove file",
|
442
443
|
dictRemoveFileConfirmation: null,
|
444
|
+
dictMaxFilesExceeded: "You can only upload {{maxFiles}} files.",
|
443
445
|
accept: function(file, done) {
|
444
446
|
return done();
|
445
447
|
},
|
@@ -541,25 +543,29 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
541
543
|
e.preventDefault();
|
542
544
|
e.stopPropagation();
|
543
545
|
if (file.status === Dropzone.UPLOADING) {
|
544
|
-
|
546
|
+
return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
|
545
547
|
return _this.removeFile(file);
|
546
|
-
}
|
548
|
+
});
|
547
549
|
} else {
|
548
550
|
if (_this.options.dictRemoveFileConfirmation) {
|
549
|
-
|
551
|
+
return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
|
550
552
|
return _this.removeFile(file);
|
551
|
-
}
|
553
|
+
});
|
552
554
|
} else {
|
553
555
|
return _this.removeFile(file);
|
554
556
|
}
|
555
557
|
}
|
556
558
|
});
|
557
|
-
|
559
|
+
file.previewElement.appendChild(file._removeLink);
|
558
560
|
}
|
561
|
+
return this._updateMaxFilesReachedClass();
|
559
562
|
},
|
560
563
|
removedfile: function(file) {
|
561
564
|
var _ref;
|
562
|
-
|
565
|
+
if ((_ref = file.previewElement) != null) {
|
566
|
+
_ref.parentNode.removeChild(file.previewElement);
|
567
|
+
}
|
568
|
+
return this._updateMaxFilesReachedClass();
|
563
569
|
},
|
564
570
|
thumbnail: function(file, dataUrl) {
|
565
571
|
var thumbnailElement;
|
@@ -600,6 +606,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
600
606
|
}
|
601
607
|
},
|
602
608
|
completemultiple: noop,
|
609
|
+
maxfilesexceeded: noop,
|
603
610
|
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>"
|
604
611
|
};
|
605
612
|
|
@@ -637,8 +644,11 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
637
644
|
element.dropzone = this;
|
638
645
|
elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
|
639
646
|
this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
|
647
|
+
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
|
648
|
+
return this.options.fallback.call(this);
|
649
|
+
}
|
640
650
|
if (this.options.url == null) {
|
641
|
-
this.options.url = this.element.action;
|
651
|
+
this.options.url = this.element.getAttribute("action");
|
642
652
|
}
|
643
653
|
if (!this.options.url) {
|
644
654
|
throw new Error("No URL provided.");
|
@@ -651,9 +661,6 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
651
661
|
delete this.options.acceptedMimeTypes;
|
652
662
|
}
|
653
663
|
this.options.method = this.options.method.toUpperCase();
|
654
|
-
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
|
655
|
-
return this.options.fallback.call(this);
|
656
|
-
}
|
657
664
|
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
|
658
665
|
fallback.parentNode.removeChild(fallback);
|
659
666
|
}
|
@@ -985,6 +992,14 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
985
992
|
return "<strong>" + (Math.round(size) / 10) + "</strong> " + string;
|
986
993
|
};
|
987
994
|
|
995
|
+
Dropzone.prototype._updateMaxFilesReachedClass = function() {
|
996
|
+
if (this.options.maxFiles && this.getAcceptedFiles().length >= this.options.maxFiles) {
|
997
|
+
return this.element.classList.add("dz-max-files-reached");
|
998
|
+
} else {
|
999
|
+
return this.element.classList.remove("dz-max-files-reached");
|
1000
|
+
}
|
1001
|
+
};
|
1002
|
+
|
988
1003
|
Dropzone.prototype.drop = function(e) {
|
989
1004
|
var files, items;
|
990
1005
|
if (!e.dataTransfer) {
|
@@ -1034,6 +1049,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1034
1049
|
return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
|
1035
1050
|
} else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
|
1036
1051
|
return done(this.options.dictInvalidFileType);
|
1052
|
+
} else if (this.options.maxFiles && this.getAcceptedFiles().length >= this.options.maxFiles) {
|
1053
|
+
done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
|
1054
|
+
return this.emit("maxfilesexceeded", file);
|
1037
1055
|
} else {
|
1038
1056
|
return this.options.accept.call(this, file, done);
|
1039
1057
|
}
|
@@ -1057,7 +1075,6 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1057
1075
|
file.accepted = false;
|
1058
1076
|
return _this._errorProcessing([file], error);
|
1059
1077
|
} else {
|
1060
|
-
file.accepted = true;
|
1061
1078
|
return _this.enqueueFile(file);
|
1062
1079
|
}
|
1063
1080
|
});
|
@@ -1074,6 +1091,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1074
1091
|
|
1075
1092
|
Dropzone.prototype.enqueueFile = function(file) {
|
1076
1093
|
var _this = this;
|
1094
|
+
file.accepted = true;
|
1077
1095
|
if (file.status === Dropzone.ADDED) {
|
1078
1096
|
file.status = Dropzone.QUEUED;
|
1079
1097
|
if (this.options.autoProcessQueue) {
|
@@ -1429,7 +1447,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1429
1447
|
|
1430
1448
|
})(Em);
|
1431
1449
|
|
1432
|
-
Dropzone.version = "3.
|
1450
|
+
Dropzone.version = "3.7.0";
|
1433
1451
|
|
1434
1452
|
Dropzone.options = {};
|
1435
1453
|
|
@@ -1592,6 +1610,14 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1592
1610
|
return elements;
|
1593
1611
|
};
|
1594
1612
|
|
1613
|
+
Dropzone.confirm = function(question, accepted, rejected) {
|
1614
|
+
if (window.confirm(question)) {
|
1615
|
+
return accepted();
|
1616
|
+
} else if (rejected != null) {
|
1617
|
+
return rejected();
|
1618
|
+
}
|
1619
|
+
};
|
1620
|
+
|
1595
1621
|
Dropzone.isValidFile = function(file, acceptedFiles) {
|
1596
1622
|
var baseMimeType, mimeType, validType, _i, _len;
|
1597
1623
|
if (!acceptedFiles) {
|
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.
|
4
|
+
version: 0.4.8
|
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-08-
|
11
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|