chris@22: module CalendarsHelper chris@22: def link_to_previous_month(year, month, options={}) chris@22: target_year, target_month = if month == 1 chris@22: [year - 1, 12] chris@22: else chris@22: [year, month - 1] chris@22: end chris@22: chris@22: name = if target_month == 12 chris@22: "#{month_name(target_month)} #{target_year}" chris@22: else chris@22: "#{month_name(target_month)}" chris@22: end chris@22: chris@22: link_to_month(('« ' + name), target_year, target_month, options) chris@22: end chris@22: chris@22: def link_to_next_month(year, month, options={}) chris@22: target_year, target_month = if month == 12 chris@22: [year + 1, 1] chris@22: else chris@22: [year, month + 1] chris@22: end chris@22: chris@22: name = if target_month == 1 chris@22: "#{month_name(target_month)} #{target_year}" chris@22: else chris@22: "#{month_name(target_month)}" chris@22: end chris@22: chris@22: link_to_month((name + ' »'), target_year, target_month, options) chris@22: end chris@22: chris@22: def link_to_month(link_name, year, month, options={}) Chris@441: link_to_content_update(link_name, params.merge(:year => year, :month => month)) chris@22: end chris@22: end