dropzonejs-rails 0.1.4 → 0.1.5
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 +139 -85
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzM0MjkzNDdiMDU2YTNkMzQ2Y2U0ZjY2MzJmZjYwZWE2ZDg2MGNhNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDg3OTBlYjM1MzA5OTRmMTBlYzkzNTljZmQ2NjJlYWJhMzY4ZTk2ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjI0MWFkODhlZTMxOTRiNWI2ZWNkOTdjOWQ0NzQzY2ZjODMzZWI4MjZhOGY5
|
10
|
+
OTEzZjU1MTBkOGM2Y2UwMmQ0MDI0MjU2MWJjN2UyZDc2NzA4MjEzZjI5NWNl
|
11
|
+
ODliOTMxM2ExMDJkY2NlZmE2NzM1MDU1YjEwZWNkZmZhMDg1MWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTQzN2M4YjQ0YmMyNDk4ZTg3YTY0MDJmMWNiOGYxMzg0ZTQ1NjdiZTQ2NTIy
|
14
|
+
ZGMyNWE3YjFhZWU0YTQwMjc1YTM1ODUxYmUyNTUyNWFhNDhmYjJmYWE5MDA0
|
15
|
+
MjJiYWYxOGQ5YzY2ZDMwYjQzYjBjMmNmNGU2MjBkN2VlOWE1ODA=
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ Go to [this secret place](https://github.com/ncuesta/dropzonejs-rails/issues).
|
|
47
47
|
**DO NOT - I repeat - DO NOT bump version numbers.** Unless you **really** need to.
|
48
48
|
|
49
49
|
|
50
|
-
### Getting the latest version of
|
50
|
+
### Getting the latest version of Dropzone
|
51
51
|
|
52
52
|
1. Update `DropzonejsRails::DROPZONE_VERSION` to the newest version of Dropzone.
|
53
53
|
1. Do a `rake get` - it'll download the file four you.
|
@@ -443,6 +443,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
443
443
|
init: function() {
|
444
444
|
return noop;
|
445
445
|
},
|
446
|
+
forceFallback: false,
|
446
447
|
fallback: function() {
|
447
448
|
var child, messageElement, span, _i, _len, _ref;
|
448
449
|
|
@@ -532,7 +533,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
532
533
|
};
|
533
534
|
|
534
535
|
function Dropzone(element, options) {
|
535
|
-
var
|
536
|
+
var elementOptions, extend, fallback, _ref;
|
536
537
|
|
537
538
|
this.element = element;
|
538
539
|
this.version = Dropzone.version;
|
@@ -543,12 +544,12 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
543
544
|
if (!(this.element && (this.element.nodeType != null))) {
|
544
545
|
throw new Error("Invalid dropzone element.");
|
545
546
|
}
|
546
|
-
if (
|
547
|
+
if (this.element.dropzone) {
|
547
548
|
throw new Error("Dropzone already attached.");
|
548
549
|
}
|
549
550
|
Dropzone.instances.push(this);
|
550
|
-
|
551
|
-
elementOptions = (_ref =
|
551
|
+
element.dropzone = this;
|
552
|
+
elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
|
552
553
|
extend = function() {
|
553
554
|
var key, object, objects, target, val, _i, _len;
|
554
555
|
|
@@ -570,7 +571,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
570
571
|
throw new Error("No URL provided.");
|
571
572
|
}
|
572
573
|
this.options.method = this.options.method.toUpperCase();
|
573
|
-
if (!Dropzone.isBrowserSupported()) {
|
574
|
+
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
|
574
575
|
return this.options.fallback.call(this);
|
575
576
|
}
|
576
577
|
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
|
@@ -588,6 +589,18 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
588
589
|
} else {
|
589
590
|
this.previewsContainer = this.element;
|
590
591
|
}
|
592
|
+
if (this.options.clickable) {
|
593
|
+
if (this.options.clickable === true) {
|
594
|
+
this.clickableElement = this.element;
|
595
|
+
} else if (typeof this.options.clickable === "string") {
|
596
|
+
this.clickableElement = document.querySelector(this.options.clickable);
|
597
|
+
} else if (this.options.clickable.nodeType != null) {
|
598
|
+
this.clickableElement = this.options.clickable;
|
599
|
+
}
|
600
|
+
if (!this.clickableElement) {
|
601
|
+
throw new Error("Invalid `clickable` element provided. Please set it to `true`, a plain HTML element or a valid CSS selector.");
|
602
|
+
}
|
603
|
+
}
|
591
604
|
this.init();
|
592
605
|
}
|
593
606
|
|
@@ -601,7 +614,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
601
614
|
if (this.element.classList.contains("dropzone") && !this.element.querySelector(".message")) {
|
602
615
|
this.element.appendChild(Dropzone.createElement("<div class=\"default message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
|
603
616
|
}
|
604
|
-
if (this.
|
617
|
+
if (this.clickableElement) {
|
605
618
|
setupHiddenFileInput = function() {
|
606
619
|
if (_this.hiddenFileInput) {
|
607
620
|
document.body.removeChild(_this.hiddenFileInput);
|
@@ -641,38 +654,47 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
641
654
|
return e.returnValue = false;
|
642
655
|
}
|
643
656
|
};
|
644
|
-
this.listeners =
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
}
|
671
|
-
if (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".message"))) {
|
672
|
-
return _this.hiddenFileInput.click();
|
657
|
+
this.listeners = [
|
658
|
+
{
|
659
|
+
element: this.element,
|
660
|
+
events: {
|
661
|
+
"dragstart": function(e) {
|
662
|
+
return _this.emit("dragstart", e);
|
663
|
+
},
|
664
|
+
"dragenter": function(e) {
|
665
|
+
noPropagation(e);
|
666
|
+
return _this.emit("dragenter", e);
|
667
|
+
},
|
668
|
+
"dragover": function(e) {
|
669
|
+
noPropagation(e);
|
670
|
+
return _this.emit("dragover", e);
|
671
|
+
},
|
672
|
+
"dragleave": function(e) {
|
673
|
+
return _this.emit("dragleave", e);
|
674
|
+
},
|
675
|
+
"drop": function(e) {
|
676
|
+
noPropagation(e);
|
677
|
+
_this.drop(e);
|
678
|
+
return _this.emit("drop", e);
|
679
|
+
},
|
680
|
+
"dragend": function(e) {
|
681
|
+
return _this.emit("dragend", e);
|
682
|
+
}
|
673
683
|
}
|
674
684
|
}
|
675
|
-
|
685
|
+
];
|
686
|
+
if (this.clickableElement) {
|
687
|
+
this.listeners.push({
|
688
|
+
element: this.clickableElement,
|
689
|
+
events: {
|
690
|
+
"click": function(evt) {
|
691
|
+
if ((_this.clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".message")))) {
|
692
|
+
return _this.hiddenFileInput.click();
|
693
|
+
}
|
694
|
+
}
|
695
|
+
}
|
696
|
+
});
|
697
|
+
}
|
676
698
|
this.enable();
|
677
699
|
return this.options.init.call(this);
|
678
700
|
};
|
@@ -722,31 +744,51 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
722
744
|
};
|
723
745
|
|
724
746
|
Dropzone.prototype.setupEventListeners = function() {
|
725
|
-
var event, listener, _ref, _results;
|
747
|
+
var elementListeners, event, listener, _i, _len, _ref, _results;
|
726
748
|
|
727
749
|
_ref = this.listeners;
|
728
750
|
_results = [];
|
729
|
-
for (
|
730
|
-
|
731
|
-
_results.push(
|
751
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
752
|
+
elementListeners = _ref[_i];
|
753
|
+
_results.push((function() {
|
754
|
+
var _ref1, _results1;
|
755
|
+
|
756
|
+
_ref1 = elementListeners.events;
|
757
|
+
_results1 = [];
|
758
|
+
for (event in _ref1) {
|
759
|
+
listener = _ref1[event];
|
760
|
+
_results1.push(elementListeners.element.addEventListener(event, listener, false));
|
761
|
+
}
|
762
|
+
return _results1;
|
763
|
+
})());
|
732
764
|
}
|
733
765
|
return _results;
|
734
766
|
};
|
735
767
|
|
736
768
|
Dropzone.prototype.removeEventListeners = function() {
|
737
|
-
var event, listener, _ref, _results;
|
769
|
+
var elementListeners, event, listener, _i, _len, _ref, _results;
|
738
770
|
|
739
771
|
_ref = this.listeners;
|
740
772
|
_results = [];
|
741
|
-
for (
|
742
|
-
|
743
|
-
_results.push(
|
773
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
774
|
+
elementListeners = _ref[_i];
|
775
|
+
_results.push((function() {
|
776
|
+
var _ref1, _results1;
|
777
|
+
|
778
|
+
_ref1 = elementListeners.events;
|
779
|
+
_results1 = [];
|
780
|
+
for (event in _ref1) {
|
781
|
+
listener = _ref1[event];
|
782
|
+
_results1.push(elementListeners.element.removeEventListener(event, listener, false));
|
783
|
+
}
|
784
|
+
return _results1;
|
785
|
+
})());
|
744
786
|
}
|
745
787
|
return _results;
|
746
788
|
};
|
747
789
|
|
748
790
|
Dropzone.prototype.disable = function() {
|
749
|
-
if (this.
|
791
|
+
if (this.clickableElement === this.element) {
|
750
792
|
this.element.classList.remove("clickable");
|
751
793
|
}
|
752
794
|
this.removeEventListeners();
|
@@ -755,7 +797,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
755
797
|
};
|
756
798
|
|
757
799
|
Dropzone.prototype.enable = function() {
|
758
|
-
if (this.
|
800
|
+
if (this.clickableElement === this.element) {
|
759
801
|
this.element.classList.add("clickable");
|
760
802
|
}
|
761
803
|
return this.setupEventListeners();
|
@@ -1012,26 +1054,68 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1012
1054
|
|
1013
1055
|
})(Em);
|
1014
1056
|
|
1015
|
-
Dropzone.version = "2.0.
|
1057
|
+
Dropzone.version = "2.0.12";
|
1016
1058
|
|
1017
1059
|
Dropzone.options = {};
|
1018
1060
|
|
1061
|
+
Dropzone.optionsForElement = function(element) {
|
1062
|
+
if (element.id) {
|
1063
|
+
return Dropzone.options[camelize(element.id)];
|
1064
|
+
} else {
|
1065
|
+
return void 0;
|
1066
|
+
}
|
1067
|
+
};
|
1068
|
+
|
1019
1069
|
Dropzone.instances = [];
|
1020
1070
|
|
1021
1071
|
Dropzone.forElement = function(element) {
|
1022
|
-
var
|
1072
|
+
var _ref;
|
1023
1073
|
|
1024
1074
|
if (typeof element === "string") {
|
1025
1075
|
element = document.querySelector(element);
|
1026
1076
|
}
|
1027
|
-
_ref =
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1077
|
+
return (_ref = element.dropzone) != null ? _ref : null;
|
1078
|
+
};
|
1079
|
+
|
1080
|
+
Dropzone.autoDiscover = true;
|
1081
|
+
|
1082
|
+
Dropzone.discover = function() {
|
1083
|
+
var checkElements, dropzone, dropzones, _i, _len, _results;
|
1084
|
+
|
1085
|
+
if (!Dropzone.autoDiscover) {
|
1086
|
+
return;
|
1087
|
+
}
|
1088
|
+
if (document.querySelectorAll) {
|
1089
|
+
dropzones = document.querySelectorAll(".dropzone");
|
1090
|
+
} else {
|
1091
|
+
dropzones = [];
|
1092
|
+
checkElements = function(elements) {
|
1093
|
+
var el, _i, _len, _results;
|
1094
|
+
|
1095
|
+
_results = [];
|
1096
|
+
for (_i = 0, _len = elements.length; _i < _len; _i++) {
|
1097
|
+
el = elements[_i];
|
1098
|
+
if (/(^| )dropzone($| )/.test(el.className)) {
|
1099
|
+
_results.push(dropzones.push(el));
|
1100
|
+
} else {
|
1101
|
+
_results.push(void 0);
|
1102
|
+
}
|
1103
|
+
}
|
1104
|
+
return _results;
|
1105
|
+
};
|
1106
|
+
checkElements(document.getElementsByTagName("div"));
|
1107
|
+
checkElements(document.getElementsByTagName("form"));
|
1108
|
+
}
|
1109
|
+
_results = [];
|
1110
|
+
for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
|
1111
|
+
dropzone = dropzones[_i];
|
1112
|
+
if (Dropzone.optionsForElement(dropzone) !== false) {
|
1113
|
+
_results.push(new Dropzone(dropzone));
|
1114
|
+
} else {
|
1115
|
+
_results.push(void 0);
|
1032
1116
|
}
|
1033
1117
|
}
|
1034
|
-
return
|
1118
|
+
return _results;
|
1035
1119
|
};
|
1036
1120
|
|
1037
1121
|
Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
|
@@ -1158,37 +1242,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
|
|
1158
1242
|
}
|
1159
1243
|
};
|
1160
1244
|
|
1161
|
-
contentLoaded(window,
|
1162
|
-
var checkElements, dropzone, dropzones, _i, _len, _results;
|
1163
|
-
|
1164
|
-
if (false) {
|
1165
|
-
dropzones = document.querySelectorAll(".dropzone");
|
1166
|
-
} else {
|
1167
|
-
dropzones = [];
|
1168
|
-
checkElements = function(elements) {
|
1169
|
-
var el, _i, _len, _results;
|
1170
|
-
|
1171
|
-
_results = [];
|
1172
|
-
for (_i = 0, _len = elements.length; _i < _len; _i++) {
|
1173
|
-
el = elements[_i];
|
1174
|
-
if (/(^| )dropzone($| )/.test(el.className)) {
|
1175
|
-
_results.push(dropzones.push(el));
|
1176
|
-
} else {
|
1177
|
-
_results.push(void 0);
|
1178
|
-
}
|
1179
|
-
}
|
1180
|
-
return _results;
|
1181
|
-
};
|
1182
|
-
checkElements(document.getElementsByTagName("div"));
|
1183
|
-
checkElements(document.getElementsByTagName("form"));
|
1184
|
-
}
|
1185
|
-
_results = [];
|
1186
|
-
for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
|
1187
|
-
dropzone = dropzones[_i];
|
1188
|
-
_results.push(new Dropzone(dropzone));
|
1189
|
-
}
|
1190
|
-
return _results;
|
1191
|
-
});
|
1245
|
+
contentLoaded(window, Dropzone.discover);
|
1192
1246
|
|
1193
1247
|
}).call(this);
|
1194
1248
|
|
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.1.
|
4
|
+
version: 0.1.5
|
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-04-
|
11
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|