dropzonejs-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDBlNjVhY2IzNjcxMTc4MzgyYzEzZGQzYWE5ZjZjMDFhZjU3M2M5OA==
5
+ data.tar.gz: !binary |-
6
+ MWEwOGVlNzYwMzdjNjhlNTM1MzI0ZDMxNWViZDFkNTExMzJlM2Q4Mw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YjgwMWM5YzNjZjY2MTcwNTUzY2M1ZTBjNjhhMDU5ZThjZTZmMDhmYzEyNDkz
10
+ NWQ1ZmQ0ZDQxYjhiNjUyYzE5ZTNmNWRlMjI1OGYwNGIxMGIxODg2NTE3YWI3
11
+ NWUzYjg4YTc5YTRlNGRhMzgyNWUyYmZkNjQ2M2NkMTY5NDk4MWI=
12
+ data.tar.gz: !binary |-
13
+ YjgxYzIzZDM0ZTg1YzIzNmZhODQ0ZDdlMWYyZDFlODY4NTU4NWE4NzdjMTY3
14
+ NjZlZTViNzVmYmJhNWYxOGYyZWRkNDYyM2MwODUwYzk2ZjEwNjBiYzZiOTdl
15
+ MzExYjViY2UwMDI4NGExNDRiNzllZWEyNWM1ZWQ0ZDIwZmFmNTM=
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.0.1'
3
- DROPZONE_VERSION = '1.3.9'
4
- end
2
+ VERSION = '0.0.2'
3
+ DROPZONE_VERSION = '1.3.12'
4
+ end
@@ -70,7 +70,6 @@ require.aliases = {};
70
70
  */
71
71
 
72
72
  require.resolve = function(path) {
73
- if (path.charAt(0) === '/') path = path.slice(1);
74
73
  var index = path + '/index.js';
75
74
 
76
75
  var paths = [
@@ -183,18 +182,17 @@ require.relative = function(parent) {
183
182
  */
184
183
 
185
184
  localRequire.resolve = function(path) {
186
- var c = path.charAt(0);
187
- if ('/' == c) return path.slice(1);
188
- if ('.' == c) return require.normalize(p, path);
189
-
190
185
  // resolve deps by returning
191
186
  // the dep in the nearest "deps"
192
187
  // directory
193
- var segs = parent.split('/');
194
- var i = lastIndexOf(segs, 'deps') + 1;
195
- if (!i) i = 0;
196
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
197
- return path;
188
+ if ('.' != path.charAt(0)) {
189
+ var segs = parent.split('/');
190
+ var i = lastIndexOf(segs, 'deps') + 1;
191
+ if (!i) i = 0;
192
+ path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
193
+ return path;
194
+ }
195
+ return require.normalize(p, path);
198
196
  };
199
197
 
200
198
  /**
@@ -411,7 +409,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
411
409
 
412
410
  __extends(Dropzone, _super);
413
411
 
414
- Dropzone.prototype.version = "1.3.9";
412
+ Dropzone.prototype.version = "1.3.12";
415
413
 
416
414
  /*
417
415
  This is a list of all available events you can register on a dropzone object.
@@ -442,6 +440,9 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
442
440
  accept: function(file, done) {
443
441
  return done();
444
442
  },
443
+ init: function() {
444
+ return o.noop;
445
+ },
445
446
  fallback: function() {
446
447
  this.element.addClass("browser-not-supported");
447
448
  this.element.find(".message").removeClass("default");
@@ -553,8 +554,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
553
554
  }
554
555
 
555
556
  Dropzone.prototype.init = function() {
556
- var capableBrowser, regex, _i, _len, _ref, _ref1,
557
- _this = this;
557
+ var capableBrowser, regex, _i, _len, _ref, _ref1;
558
558
  if (this.elementTagName === "form" && this.element.attr("enctype") !== "multipart/form-data") {
559
559
  this.element.attr("enctype", "multipart/form-data");
560
560
  }
@@ -578,29 +578,14 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
578
578
  return this.options.fallback.call(this);
579
579
  }
580
580
  if (this.options.clickable) {
581
- this.element.addClass("clickable");
582
581
  this.hiddenFileInput = o("<input type=\"file\" multiple />");
583
- this.element.click(function(evt) {
584
- var target;
585
- target = o(evt.target);
586
- if (target.is(_this.element) || target.is(_this.element.find(".message"))) {
587
- return _this.hiddenFileInput.click();
588
- }
589
- });
590
- this.hiddenFileInput.change(function() {
591
- var files;
592
- files = _this.hiddenFileInput.get(0).files;
593
- _this.emit("selectedfiles", files);
594
- if (files.length) {
595
- return _this.handleFiles(files);
596
- }
597
- });
598
582
  }
599
583
  this.files = [];
600
584
  this.filesQueue = [];
601
585
  this.filesProcessing = [];
602
586
  this.URL = (_ref1 = window.URL) != null ? _ref1 : window.webkitURL;
603
- return this.setupEventListeners();
587
+ this.setupEventListeners();
588
+ return this.options.init.call(this);
604
589
  };
605
590
 
606
591
  Dropzone.prototype.getFallbackForm = function() {
@@ -619,13 +604,18 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
619
604
  return fields;
620
605
  };
621
606
 
622
- Dropzone.prototype.setupEventListeners = function() {
607
+ Dropzone.prototype.setupEventListeners = function(initial) {
623
608
  var eventName, noPropagation, _i, _len, _ref,
624
609
  _this = this;
625
- _ref = this.events;
626
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
627
- eventName = _ref[_i];
628
- this.on(eventName, this.options[eventName]);
610
+ if (initial == null) {
611
+ initial = true;
612
+ }
613
+ if (initial) {
614
+ _ref = this.events;
615
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
616
+ eventName = _ref[_i];
617
+ this.on(eventName, this.options[eventName]);
618
+ }
629
619
  }
630
620
  noPropagation = function(e) {
631
621
  e.stopPropagation();
@@ -650,22 +640,47 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
650
640
  _this.drop(e);
651
641
  return _this.emit("drop", e);
652
642
  });
653
- return this.element.on("dragend.dropzone", function(e) {
643
+ this.element.on("dragend.dropzone", function(e) {
654
644
  return _this.emit("dragend", e);
655
645
  });
646
+ if (this.options.clickable) {
647
+ this.element.addClass("clickable");
648
+ this.element.on("click.dropzone", function(evt) {
649
+ var target;
650
+ target = o(evt.target);
651
+ if (target.is(_this.element) || target.is(_this.element.find(".message"))) {
652
+ return _this.hiddenFileInput.click();
653
+ }
654
+ });
655
+ return this.hiddenFileInput.on("change", function() {
656
+ var files;
657
+ files = _this.hiddenFileInput.get(0).files;
658
+ _this.emit("selectedfiles", files);
659
+ if (files.length) {
660
+ return _this.handleFiles(files);
661
+ }
662
+ });
663
+ }
656
664
  };
657
665
 
658
666
  Dropzone.prototype.removeEventListeners = function() {
659
- return this.element.off(".dropzone");
667
+ this.element.off(".dropzone");
668
+ if (this.options.clickable) {
669
+ this.element.removeClass("clickable");
670
+ return this.hiddenFileInput.off();
671
+ }
660
672
  };
661
673
 
662
674
  Dropzone.prototype.disable = function() {
663
675
  this.removeEventListeners();
664
- this.files = [];
665
676
  this.filesProcessing = [];
666
677
  return this.filesQueue = [];
667
678
  };
668
679
 
680
+ Dropzone.prototype.enable = function() {
681
+ return this.setupEventListeners(false);
682
+ };
683
+
669
684
  Dropzone.prototype.filesize = function(size) {
670
685
  var string;
671
686
  if (size >= 100000000000) {
@@ -818,7 +833,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
818
833
  };
819
834
 
820
835
  Dropzone.prototype.uploadFile = function(file) {
821
- var formData, handleError, input, inputElement, inputName, key, name, progressObj, xhr, _i, _len, _ref, _ref1, _ref2,
836
+ var formData, handleError, input, inputElement, inputName, key, progressObj, value, xhr, _i, _len, _ref, _ref1, _ref2,
822
837
  _this = this;
823
838
  xhr = new XMLHttpRequest();
824
839
  xhr.open("POST", this.options.url, true);
@@ -853,8 +868,8 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
853
868
  if (this.options.params) {
854
869
  _ref1 = this.options.params;
855
870
  for (key in _ref1) {
856
- name = _ref1[key];
857
- formData.append(name, key);
871
+ value = _ref1[key];
872
+ formData.append(key, value);
858
873
  }
859
874
  }
860
875
  if (this.elementTagName = "FORM") {
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropzonejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - José Nahuel Cuesta Luengo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
11
+ date: 2013-03-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>'
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>'
28
25
  - !ruby/object:Gem::Version
@@ -45,32 +42,25 @@ files:
45
42
  - README.md
46
43
  homepage: http://www.github.com/ncuesta/dropzonejs-rails
47
44
  licenses: []
45
+ metadata: {}
48
46
  post_install_message:
49
47
  rdoc_options: []
50
48
  require_paths:
51
49
  - lib
52
50
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
51
  requirements:
55
52
  - - ! '>='
56
53
  - !ruby/object:Gem::Version
57
54
  version: '0'
58
- segments:
59
- - 0
60
- hash: 4125991172676457206
61
55
  required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
56
  requirements:
64
57
  - - ! '>='
65
58
  - !ruby/object:Gem::Version
66
59
  version: '0'
67
- segments:
68
- - 0
69
- hash: 4125991172676457206
70
60
  requirements: []
71
61
  rubyforge_project:
72
- rubygems_version: 1.8.25
62
+ rubygems_version: 2.0.1
73
63
  signing_key:
74
- specification_version: 3
64
+ specification_version: 4
75
65
  summary: Integrates Dropzone JS File upload into Rails Asset pipeline.
76
66
  test_files: []