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