woody-decorators 7.17.0 → 7.18.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/brief.rb +44 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0101564724b3e7c1f853369dcef804d69e0877bd
|
4
|
+
data.tar.gz: d7203b89957c7a742fb33bbbde3c24cd86cab3d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3a77ae4cc506efa5a926c050262fce00ec3202c4a169701e30b58efbe4f50c2c761e69f16c55698e6ef6f7b0e5e0f00f55fb74b6bb1388f40a0d26581f52e7
|
7
|
+
data.tar.gz: 2b78778609bc40b8c0f46935870947aa830eaaa5b1745e23ac08843d73ad68037f783180f311a327905c80cb35d0f5db534167c4cf499b19bbc88c15d4fb449f
|
data/lib/woody/decorators.rb
CHANGED
@@ -25,7 +25,7 @@ module Woody
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def draft?
|
28
|
-
status == '
|
28
|
+
@model.status == 'draft' || @model.end_date.nil?
|
29
29
|
end
|
30
30
|
|
31
31
|
def ended?(submission = nil)
|
@@ -73,10 +73,15 @@ module Woody
|
|
73
73
|
format('£%d', t)
|
74
74
|
end
|
75
75
|
|
76
|
-
def status
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
def status(submission = nil)
|
77
|
+
case @model.category
|
78
|
+
when 'brand'
|
79
|
+
brand_category_status
|
80
|
+
when 'vidsy'
|
81
|
+
vidsy_category_status(submission)
|
82
|
+
when 'squad'
|
83
|
+
squad_category_status(submission)
|
84
|
+
end
|
80
85
|
end
|
81
86
|
|
82
87
|
def brand_status
|
@@ -89,8 +94,18 @@ module Woody
|
|
89
94
|
brand_status.downcase.gsub(' ', '-')
|
90
95
|
end
|
91
96
|
|
92
|
-
def time_left
|
93
|
-
|
97
|
+
def time_left(submission = nil)
|
98
|
+
case @model.category
|
99
|
+
when 'brand'
|
100
|
+
Time.diff(DateTime.now, @model.end_date, '%d %H')[:diff]
|
101
|
+
when 'vidsy'
|
102
|
+
end_date = DateTime.parse(submission.created_at).advance(hours: @model.duration)
|
103
|
+
Time.diff(DateTime.now, end_date, '%d %H')[:diff]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def time_remaining(submission = nil)
|
108
|
+
format('%s remaining', time_left(submission))
|
94
109
|
end
|
95
110
|
|
96
111
|
def title(truncate: false, size: 15)
|
@@ -134,6 +149,28 @@ module Woody
|
|
134
149
|
|
135
150
|
DATE_FORMAT = '%Y/%m/%d %H:%M'
|
136
151
|
|
152
|
+
def brand_category_status
|
153
|
+
return 'Draft' if draft?
|
154
|
+
return time_remaining if DateTime.parse(@model.end_date) > DateTime.now
|
155
|
+
purchased_videos > 0 ? 'Complete' : 'Video Review'
|
156
|
+
end
|
157
|
+
|
158
|
+
def vidsy_category_status(submission)
|
159
|
+
return 'Complete' if ended?(submission)
|
160
|
+
time_remaining(submission)
|
161
|
+
end
|
162
|
+
|
163
|
+
def squad_category_status(submission)
|
164
|
+
case submission.state
|
165
|
+
when 'pending'
|
166
|
+
'Awaiting Approval'
|
167
|
+
when 'declined'
|
168
|
+
'More spaces opening soon!'
|
169
|
+
when 'approved'
|
170
|
+
'Active'
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
137
174
|
def sorted_posts
|
138
175
|
@model.insights('posts').sort do |a, b|
|
139
176
|
DateTime.parse(b['data']['created_timestamp']) <=>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woody-decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|