Module: Eboshi::CalendarHelper

Defined in:
app/helpers/eboshi/calendar_helper.rb,
app/helpers/eboshi/calendar_helper.rb

Instance Method Summary collapse

Instance Method Details

#calendar(options = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/eboshi/calendar_helper.rb', line 5

def calendar(options = {}, &block)
  defaults = {
    year: Date.today.year,
    month: Date.today.month,
    previous_month_text: nil,
    next_month_text: nil
  }
  options.reverse_merge! defaults

  first = Date.civil(options[:year], options[:month], 1)
  last = first.end_of_month

  build first, last, options, &block
end


69
70
71
# File 'app/helpers/eboshi/calendar_helper.rb', line 69

def link_to_next_month(date, options = {})
  link_to_month(:next, date, options)
end


65
66
67
# File 'app/helpers/eboshi/calendar_helper.rb', line 65

def link_to_previous_month(date, options = {})
  link_to_month(:prev, date, options)
end