annotate .svn/pristine/c7/c77ac5664a51030570530480da86c95e1084dfb0.svn-base @ 1477:f2ad2199b49a bibplugin_integration

Close obsolete branch bibplugin_integration
author Chris Cannam
date Fri, 30 Nov 2012 14:41:31 +0000
parents cbb26bc654de
children
rev   line source
Chris@909 1 # encoding: utf-8
Chris@909 2 #
Chris@909 3 # Redmine - project management software
Chris@909 4 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@909 5 #
Chris@909 6 # This program is free software; you can redistribute it and/or
Chris@909 7 # modify it under the terms of the GNU General Public License
Chris@909 8 # as published by the Free Software Foundation; either version 2
Chris@909 9 # of the License, or (at your option) any later version.
Chris@909 10 #
Chris@909 11 # This program is distributed in the hope that it will be useful,
Chris@909 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@909 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@909 14 # GNU General Public License for more details.
Chris@909 15 #
Chris@909 16 # You should have received a copy of the GNU General Public License
Chris@909 17 # along with this program; if not, write to the Free Software
Chris@909 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@909 19
Chris@909 20 module CalendarsHelper
Chris@909 21 def link_to_previous_month(year, month, options={})
Chris@909 22 target_year, target_month = if month == 1
Chris@909 23 [year - 1, 12]
Chris@909 24 else
Chris@909 25 [year, month - 1]
Chris@909 26 end
Chris@909 27
Chris@909 28 name = if target_month == 12
Chris@909 29 "#{month_name(target_month)} #{target_year}"
Chris@909 30 else
Chris@909 31 "#{month_name(target_month)}"
Chris@909 32 end
Chris@909 33
Chris@909 34 # \xc2\xab(utf-8) = «
Chris@909 35 link_to_month(("\xc2\xab " + name), target_year, target_month, options)
Chris@909 36 end
Chris@909 37
Chris@909 38 def link_to_next_month(year, month, options={})
Chris@909 39 target_year, target_month = if month == 12
Chris@909 40 [year + 1, 1]
Chris@909 41 else
Chris@909 42 [year, month + 1]
Chris@909 43 end
Chris@909 44
Chris@909 45 name = if target_month == 1
Chris@909 46 "#{month_name(target_month)} #{target_year}"
Chris@909 47 else
Chris@909 48 "#{month_name(target_month)}"
Chris@909 49 end
Chris@909 50
Chris@909 51 # \xc2\xbb(utf-8) = »
Chris@909 52 link_to_month((name + " \xc2\xbb"), target_year, target_month, options)
Chris@909 53 end
Chris@909 54
Chris@909 55 def link_to_month(link_name, year, month, options={})
Chris@909 56 link_to_content_update(h(link_name), params.merge(:year => year, :month => month))
Chris@909 57 end
Chris@909 58 end