3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/helpers/spark/trial_helper.rb', line 3
def trialing( end_date, url, options={} )
options[:class] = 'trial-status'
days = [0, (end_date.to_date - Time.zone.now.to_date).to_i].max
text = %Q{#{pluralize(days, 'day')} left in trial}
if days < 1
options[:class] += ' trial-ended'
elsif days < 5
options[:class] += ' trial-ending-soon'
end
content_tag( :div, options ) do
concat content_tag( :span, class: 'trial-status-text' ) { text }
concat " "
concat link_to "Manage", url, class: 'trial-status-link'
end
end
|