woody-decorators 7.7.1 → 7.8.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 +19 -0
- 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: f83f028be973d1bdcfe71b405e55b281f0d36628
|
4
|
+
data.tar.gz: 7e08bb3b1ee65aa6035ac9cf34a1afeff255ce07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 985e54adab4a4d173bc113fda5ac9aadfa0a80a4a168b69e396064f6e4abb6faa91951ce724d27e4938c80a81e5cd5a727413122ac0cb3e4f1b25201f2860ab7
|
7
|
+
data.tar.gz: 92049bf72be4e595863ccc738195132d1bc165a36c6a49b25e1c802f984b8a4522055b58cc8c89fd6403cd1884ce1f10f8ca1d3f15f340d6a6fafbfb92394750
|
data/lib/woody/decorators.rb
CHANGED
@@ -70,6 +70,16 @@ module Woody
|
|
70
70
|
purchased_videos > 0 ? 'Complete' : 'Video Review'
|
71
71
|
end
|
72
72
|
|
73
|
+
def brand_status
|
74
|
+
return 'In Development' if @model.status == 'draft' || @model.end_date.nil?
|
75
|
+
return 'Live' if is_live?
|
76
|
+
purchased_videos > 0 ? 'Complete' : 'Video Review'
|
77
|
+
end
|
78
|
+
|
79
|
+
def brand_status_identifier
|
80
|
+
brand_status.downcase.gsub(' ', '-')
|
81
|
+
end
|
82
|
+
|
73
83
|
def time_left
|
74
84
|
Time.diff(DateTime.now, @model.end_date, '%d %H')[:diff]
|
75
85
|
end
|
@@ -115,6 +125,15 @@ module Woody
|
|
115
125
|
|
116
126
|
DATE_FORMAT = '%Y/%m/%d %H:%M'
|
117
127
|
|
128
|
+
def is_live?
|
129
|
+
DateTime.parse(@model.end_date) > DateTime.now &&
|
130
|
+
(selected_videos == 0 && purchased_videos == 0)
|
131
|
+
end
|
132
|
+
|
133
|
+
def selected_videos
|
134
|
+
@selected_videos ||= @model.videos(state: 'selected').size
|
135
|
+
end
|
136
|
+
|
118
137
|
def purchased_videos
|
119
138
|
@purchased_videos ||= @model.videos(state: 'purchased').size
|
120
139
|
end
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|