mongoid-direct-s3-upload 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e0d2641b4ce3a70b19f1eb4ca23dfbcc3363052
4
- data.tar.gz: e44ee934851643232aca8a968beba504c2d883af
3
+ metadata.gz: '05091069c4cd1d4fec38def15768a40de581821d'
4
+ data.tar.gz: 010504eefb3107857ecc621f8f335fb7d8d63541
5
5
  SHA512:
6
- metadata.gz: acef0474e52f116a3e407696dc8db7fcf58182a4a9904e4b22c4302c252c7ff1620610ed2811a612d2745b129354a5798b970a6f29158549b3164702138fbef6
7
- data.tar.gz: 8544fb25b876bb031084308f05956afe623a7ed8d4704bed3cd6e85dbe3678092934f7a468be025942738dd6fdbe1814b07d1746f62e52c8eb90761b3a4d8aff
6
+ metadata.gz: a503366376acc260d2b732f9fe2cd8c414a0229d2b883809ad6e6251a9368652429ce51d3b95ee488bd08925a4d977e8fdb0c56aaa7770bb8d504b515c935a65
7
+ data.tar.gz: 9930bbd21562aef4a65bc21e658b2c4a6fe72c96bd4d78bfd892a118c08c767f04bc625ab062bf5e002f1e012acbd3a96a255e839b34fb1605e9a23ede800bfe
@@ -73,7 +73,7 @@ uploadFile = (container, file) ->
73
73
  uuid = data.uuid
74
74
 
75
75
  uploadList = $(".s3r-upload-list", container)
76
- uploadList.prepend("<tr id='#{uuid}'><td><div class='s3r-file-url'>#{fileName}</div></td><td class='s3r-progress'><div class='s3r-bar' style='display: none;'><div class='s3r-meter'></div></div></td></tr>")
76
+ uploadList.prepend("<tr id='#{uuid}'><td><div class='s3r-file-url'>#{fileName}</div></td><td class='s3r-progress'><div class='s3r-bar progress' style='display: none;'><div class='s3r-meter progress-bar progress-bar-striped progress-bar-animated info'></div></div></td></tr>")
77
77
  fileColumn = $(".s3r-upload-list ##{uuid} .s3r-file-url", container)
78
78
  progressColumn = $(".s3r-upload-list ##{uuid} .s3r-progress", container)
79
79
  progressBar = $(".s3r-bar", progressColumn)
@@ -84,13 +84,15 @@ uploadFile = (container, file) ->
84
84
  percentage = ((ev.loaded / ev.total) * 100.0).toFixed(0)
85
85
  progressBar.show()
86
86
  progressMeter.css "width", "#{percentage}%"
87
+ if percentage > 10
88
+ progressMeter.html "#{percentage}% &nbsp; "
87
89
  else
88
90
  progressColumn.text("Uploading...") # IE can't get position
89
91
 
90
92
  xhr.onreadystatechange = (ev) ->
91
93
  if xhr.readyState is 4
92
- progressColumn.text("") # IE can't get position
93
- progressBar.remove()
94
+ progressMeter.html("Done &nbsp; ") # IE can't get position
95
+ progressMeter.removeClass("progress-bar-animated")
94
96
 
95
97
  if xhr.status == 201
96
98
  contentType = file.type
@@ -1,31 +1,19 @@
1
1
  .s3r-upload-list {
2
2
  border: 1px solid #ccc;
3
3
  border-collapse: collapse;
4
- margin: 15px 0;
4
+ margin: 0;
5
+ width: 75%;
5
6
  }
6
7
 
7
8
  .s3r-upload-list td {
8
9
  border-bottom: 1px solid #ccc;
9
10
  padding: .5em;
10
- width: 180px;
11
+ width: 50%;
11
12
  }
12
13
 
13
14
  .s3r-file-url {
14
15
  overflow: hidden;
15
16
  text-overflow: ellipsis;
16
17
  white-space: nowrap;
17
- width: 180px;
18
- }
19
-
20
- .s3r-bar {
21
- background-color: #eee;
22
- border-radius: 3px;
23
- height: 15px;
24
- width: 180px;
25
- }
26
-
27
- .s3r-meter {
28
- background-color: #43ac6a;
29
- border-radius: 3px;
30
- height: 15px;
31
- }
18
+ width: 100%;
19
+ }
@@ -58,10 +58,22 @@ module S3Relay
58
58
  S3Relay::PrivateUrl.new(uuid, filename).public_url
59
59
  end
60
60
 
61
+ def public_url_500x500
62
+ file_full_s3_key = public_url.split('amazonaws.com/')[1]
63
+ "http://epartrade.s3-website-us-west-1.amazonaws.com/500x500/#{file_full_s3_key}"
64
+ end
65
+
61
66
  def private_url
62
67
  S3Relay::PrivateUrl.new(uuid, filename).generate
63
68
  end
64
69
 
70
+ def as_json(options = { })
71
+ h = super(options)
72
+ h[:public_url] = public_url
73
+ h[:public_url_500x500] = public_url_500x500
74
+ h
75
+ end
76
+
65
77
  private
66
78
 
67
79
  def finalize
@@ -1,3 +1,3 @@
1
1
  module S3Relay
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-direct-s3-upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - hartator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails