s3ff 0.11.0 → 0.12.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bd380626001b2b203f6924a3b66d6e89bf28c7e
4
- data.tar.gz: 0cd8675ecdd614a797e39062e46b9f97ae795000
3
+ metadata.gz: bcf736d404180f697959d82d620993018d078882
4
+ data.tar.gz: f3a1ce7709027b08b302a0a6dc64e3953147aa8b
5
5
  SHA512:
6
- metadata.gz: 8c1ed0e0a858f87395cbd48fcb03b33f09ef844404f8701a971a23377d0d36721c32134d44eccb9d2b10222fa96b56728f350df9156eb2545ab523763d97561e
7
- data.tar.gz: f61cbbea7b9c342d5005a6f1f90e7c7db2fe312892d7f54dc1e624de76abeb5572b6e006dab901d0d11e37e6e680ccbf4bec4c2404102317ab18239f5289b4ce
6
+ metadata.gz: 50d9807e83124f2feca1ae22d3874ba806e6438c01cccf16d28415f8d97b32e8e9d92f1ebe4e54aafa66a99c84004d5a08b9da0e84aed3533e3eebe8a82f93d8
7
+ data.tar.gz: 66ba7a6c6a5b99a63133c962575f9f8aaa09e53f2fb72e48fca5dc3352aab950509da8a20ae82404cf9682cdcd7c4d7e83e196a834b17cf215753511fbd0bfd4
@@ -42,36 +42,37 @@ $(function() {
42
42
 
43
43
  var s3ff_handlers = {
44
44
  drop: function(e, data) {
45
- if (that[0] != e.originalEvent.target) return e.preventDefault();
46
- if (! multi) $.observable(obj).refresh(data.files);
45
+ if (e.delegatedEvent.target.parentNode != wrap[0]) return e.preventDefault();
46
+ $.observable(obj).refresh(data.files);
47
47
  },
48
48
  change: function(e, data) {
49
- if (! multi) $.observable(obj).refresh(data.files);
49
+ $.observable(obj).refresh(data.files);
50
50
  },
51
51
  send: function(e, data) {
52
52
  $.each(obj, function() {
53
53
  if (data.files[0].unique_id == this.unique_id) {
54
- dom.find('.s3ff_bar').parent().show();
54
+ this.progress_pct = "0%";
55
55
  this.placeholder = placeholder;
56
56
  }
57
57
  });
58
- // $.observable(obj).refresh(obj); // progress bar animation doesn't work
58
+ $.observable(obj).refresh(obj);
59
59
  },
60
60
  progress: function(e, data) {
61
+ // $.observable(obj).refresh(obj); // progress bar animation doesn't work
62
+ // :. adjust manually
61
63
  $.each(obj, function() {
62
64
  if (data.files[0].unique_id == this.unique_id) {
63
- this.progress = (parseInt(data.loaded / data.total * 100, 10)) + "%";
64
- dom.find('.s3ff_bar').css({width: this.progress}).text(this.progress);
65
+ this.progress_pct = (parseInt(data.loaded / data.total * 100, 10)) + "%";
66
+ dom.find('#s3ff_progress-' + this.unique_id).show().find('.s3ff_bar').css({width: this.progress_pct}).text(this.name);
65
67
  }
66
68
  });
67
- // $.observable(obj).refresh(obj); // progress bar animation doesn't work
68
69
  },
69
70
  done: function(e, data) {
70
- var field_prefix = that.attr('name').replace(/\]$/, '');
71
+ var field_prefix = that.attr('name').replace(/(\]\[\]|\])$/, '');
71
72
  $.each(obj, function() {
72
73
  if (data.files[0].unique_id == this.unique_id) {
73
- delete this.progress;
74
- this.fieldname = field_prefix + '_direct_url';
74
+ delete this.progress_pct;
75
+ this.fieldname = field_prefix + '_direct_url]' + (multi ? '[]' : '');
75
76
  this.result = data.result;
76
77
  }
77
78
  });
@@ -81,7 +82,6 @@ $(function() {
81
82
  $.each(obj, function() {
82
83
  if (data.files[0].unique_id == this.unique_id) {
83
84
  this.progress_pct = "80%";
84
- this.progress_style = "width:" + this.progress_pct;
85
85
  this.failReason = data.failReason || data.textStatus || 'Failed!';
86
86
  }
87
87
  });
@@ -89,7 +89,7 @@ $(function() {
89
89
  },
90
90
  add: function(e, data) {
91
91
  // beginning; disable submit
92
- wrap.parents("form").find("[type='submit']").each(function() {
92
+ wrap.parents("form").find("button,[type='submit']").each(function() {
93
93
  this.uploading = this.uploading || 0;
94
94
  $(this).attr({'disabled': (++this.uploading > 0)});
95
95
  });
@@ -97,7 +97,7 @@ $(function() {
97
97
  },
98
98
  always: function(e, data) {
99
99
  // end; re-enable submit
100
- wrap.parents("form").find("[type='submit']").each(function() {
100
+ wrap.parents("form").find("button,[type='submit']").each(function() {
101
101
  this.uploading = this.uploading || 0;
102
102
  $(this).attr({'disabled': (--this.uploading > 0)});
103
103
  });
@@ -111,4 +111,17 @@ $(function() {
111
111
  $(s3ff.selector).each(s3ff.init);
112
112
  $(document).on("mouseenter mousedown touchstart", s3ff.selector, s3ff.init);
113
113
  });
114
+
115
+ $(document).bind('dragover', function (e) {
116
+ var timeout = s3ff.dropZoneTimeout;
117
+ if (! timeout) {
118
+ $(document.body).addClass('s3ff_dragover');
119
+ } else {
120
+ clearTimeout(timeout);
121
+ }
122
+ s3ff.dropZoneTimeout = setTimeout(function () {
123
+ $(document.body).removeClass('s3ff_dragover');
124
+ s3ff.dropZoneTimeout = null;
125
+ }, 100);
126
+ });
114
127
  });
data/lib/s3ff/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module S3FF
2
- VERSION = '0.11.0'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -5,16 +5,22 @@ module S3FF
5
5
  <div style="display:none;">
6
6
  <script id="s3ff_template" type="text/x-tmpl">
7
7
  {^{if failReason}}
8
- <div class="progress s3ff_progress">
9
- <div class="progress-bar progress-bar-danger s3ff_bar" style="width:80%;">
8
+ <div class="progress s3ff_progress" id="s3ff_progress-{{:unique_id}}">
9
+ <div class="progress-bar progress-bar-danger s3ff_bar" style="width:{{:progress_pct}}">
10
10
  <span class="fa fa-exclamation-triangle"></span>
11
11
  {^{:failReason}}
12
12
  </div>
13
13
  </div>
14
14
  {^{else}}
15
- <div class="progress s3ff_progress" style="display:none;">
16
- <div class="progress-bar progress-bar-striped active s3ff_bar" style="width:0%;"></div>
17
- </div>
15
+ {^{if progress_pct}}
16
+ <div class="progress s3ff_progress" id="s3ff_progress-{{:unique_id}}">
17
+ <div class="progress-bar progress-bar-striped active s3ff_bar" style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:{{:progress_pct}}">{{:name}}</div>
18
+ </div>
19
+ {^{else}}
20
+ <div class="progress s3ff_progress" id="s3ff_progress-{{:unique_id}}" style="display:none;">
21
+ <div class="progress-bar progress-bar-striped active s3ff_bar" style="width:0%;"></div>
22
+ </div>
23
+ {{/if}}
18
24
  {{/if}}
19
25
  {^{if result}}
20
26
  <div class="thumbnail" id="upload-{{:unique_id}}">
@@ -32,17 +38,19 @@ module S3FF
32
38
  </div>
33
39
  {^{else}}
34
40
  {^{if placeholder}}
35
- <div class="thumbnail" id="upload-{{:unique_id}}">
36
- {^{if placeholder.url}}
37
- <img data-link="src{:placeholder.url}">
38
- {{/if}}
39
- {^{if placeholder.filename}}
40
- <div class="caption">
41
- <span class="fa fa-file-o"></span>
42
- {^{:placeholder.filename}}
43
- </div>
44
- {{/if}}
45
- </div>
41
+ {^{if placeholder.url || placeholder.filename}}
42
+ <div class="thumbnail" id="upload-{{:unique_id}}">
43
+ {^{if placeholder.url}}
44
+ <img data-link="src{:placeholder.url}">
45
+ {{/if}}
46
+ {^{if placeholder.filename}}
47
+ <div class="caption">
48
+ <span class="fa fa-file-o"></span>
49
+ {^{:placeholder.filename}}
50
+ </div>
51
+ {{/if}}
52
+ </div>
53
+ {{/if}}
46
54
  {{/if}}
47
55
  {{/if}}
48
56
  </script>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3ff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chew Choon Keat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-28 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: s3_file_field
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.4.2
106
+ rubygems_version: 2.4.3
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Direct S3 upload using CORS with s3_file_field + paperclip