-
Notifications
You must be signed in to change notification settings - Fork 90
Further Examples
tinto101 edited this page Sep 13, 2010
·
1 revision
<%= calendar(:year => @date.year, :month =>@date.month, :first_day_of_week =>1, :next_month_text => link_to (">>", :action=>'index', :params => {:date => @date.next_month.strftime("%Y-%m")}), :previous_month_text => link_to ("<<",:action=>'index',:params => {:date => @date.last_month.strftime("%Y-%m")})) %>
def index
@date = Time.parse("#{params[:date]} || Time.now")
end
the :year and :month are set by the new date attribute of the page and the previous_month_text and next_month_text month text have been set to be links that replace the value of the @date attribute to be the new month that the user would like to see.