18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/helpers/e9_crm/page_views_helper.rb', line 18
def page_view_date_select_options(options = {})
@_first_date ||= PageView.order(:created_at).first.try(:created_at) || Date.today
date, cdate = @_first_date, Date.today
sel_options = []
if options[:type] == :until
prefix = 'Up to '
label = prefix + ' Now'
elsif options[:type] == :in_month
prefix = 'Closed in '
label = 'Since Inception'
else
prefix = 'Since '
label = prefix + ' Inception'
end
begin
sel_options << [date.strftime("#{prefix}%B %Y"), date.strftime('%Y/%m')]
date += 1.month
end while date.year <= cdate.year && date.month <= cdate.month
sel_options.reverse!
sel_options.unshift([label, nil])
options_for_select(sel_options)
end
|