Skip to content

Instantly share code, notes, and snippets.

@TomK32
Created January 27, 2009 10:05
Show Gist options
  • Save TomK32/53266 to your computer and use it in GitHub Desktop.
Save TomK32/53266 to your computer and use it in GitHub Desktop.
<%=
calendar_for(current_timespan.first.year, current_timespan.first.month,
:month_navigation_url_helper => :calendar_events_path,
:month_navigation_url_helper_args => {:section => @section} ) do |day|
if calendar_section.days_in_month_with_events(day).include?(day)
[link_to(day.day, calendar_events_path(:section => @section, :year => day.year, :month => day.month, :day => day.mday)), { :class => "dayWithEvents" }]
else
day.day
end
end
%>
def show_month_names
return if @options[:hide_month_name]
%(<tr>
<th colspan="7">#{previous_month_link}#{I18n.localize(@days.first, :format => @options[:header_date_format])}#{next_month_link}</th>
</tr>)
end
def previous_month_link
month_navigation_link(@options[:month_navigation_format][0], @month - 1)
end
def next_month_link
month_navigation_link(@options[:month_navigation_format][1], @month + 1)
end
def month_navigation_link(link_format, month)
method(@options[:month_navigation_url_helper]).call( I18n.localize(@days.first, :format => @options[:header_date_format]), {:year => @year, :month => month})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment