Class: Spark::TrialNotice
Instance Method Summary
collapse
#selector, #to_s, #unique_id
Constructor Details
Returns a new instance of TrialNotice.
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/components/spark/trial_notice.rb', line 9
def initialize(*)
super
classname.add("spark-trial-notice")
if days < 1
classname.add("trial-ended")
elsif 1 <= days && days < 5
classname.add("trial-ending-soon")
end
end
|
Instance Method Details
#days ⇒ Object
31
32
33
|
# File 'app/components/spark/trial_notice.rb', line 31
def days
[0, (@end_date.to_date - Time.zone.now.to_date).to_i].max
end
|
#status_color ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'app/components/spark/trial_notice.rb', line 21
def status_color
if days < 1
:red
elsif 1 <= days && days < 5
:yellow
else
:purple
end
end
|