woody-decorators 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/woody/decorators.rb +1 -1
- data/lib/woody/decorators/collective.rb +35 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3325e7a7b006e18bf625ccf47d6e99fdd1f16e92
|
4
|
+
data.tar.gz: cb72c63c4b830a34d1c2c9b978d9c2e80e0de2c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0578b195053d4e71130aa14a460c4d3cdaf051dd1514bdecbb75102b67fc186e0275623051fe93266c6167317f6fcb5f0b395976cd094a281006a9e5449f6133
|
7
|
+
data.tar.gz: 386d369ce698c24f5272638de9cad29aacad7b9369d32525d099ea5a604e4bbd455da7f8e3b06d54bbb52dcaa974e6b414d96c0853ebb73c621a6746e5170e12
|
data/lib/woody/decorators.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "woody/decorators/base"
|
2
|
+
|
3
|
+
module Woody
|
4
|
+
module Decorators
|
5
|
+
class Collective < Base
|
6
|
+
def initialize(model, config)
|
7
|
+
@config = config
|
8
|
+
super(model)
|
9
|
+
end
|
10
|
+
|
11
|
+
def image_src(type = "png")
|
12
|
+
[s3_base, suffix(type)].join("/")
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def app_config
|
18
|
+
@aws_config ||= @config.app
|
19
|
+
end
|
20
|
+
|
21
|
+
def s3_base
|
22
|
+
[
|
23
|
+
app_config["s3_domain"],
|
24
|
+
app_config["public_s3_bucket"],
|
25
|
+
"creator/collectives"
|
26
|
+
].join("/")
|
27
|
+
end
|
28
|
+
|
29
|
+
def suffix(type)
|
30
|
+
id = @model.id
|
31
|
+
id.to_s.size == 1 ? "00#{id}.#{type}" : "0#{id}.#{type}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woody-decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/woody/decorators/brand_user.rb
|
151
151
|
- lib/woody/decorators/challenge.rb
|
152
152
|
- lib/woody/decorators/challenge_question.rb
|
153
|
+
- lib/woody/decorators/collective.rb
|
153
154
|
- lib/woody/decorators/creator_user.rb
|
154
155
|
- lib/woody/decorators/submission.rb
|
155
156
|
- lib/woody/decorators/user.rb
|