##// END OF EJS Templates
fix calendar links for previous/next month (#8989)....
Toshi MARUYAMA -
r6286:2b1dd9da42d1
parent child
Show More
@@ -1,37 +1,39
1 1 module CalendarsHelper
2 2 def link_to_previous_month(year, month, options={})
3 3 target_year, target_month = if month == 1
4 4 [year - 1, 12]
5 5 else
6 6 [year, month - 1]
7 7 end
8 8
9 9 name = if target_month == 12
10 10 "#{month_name(target_month)} #{target_year}"
11 11 else
12 12 "#{month_name(target_month)}"
13 13 end
14 14
15 link_to_month(('« ' + name), target_year, target_month, options)
15 # \xc2\xab(utf-8) = «
16 link_to_month(("\xc2\xab " + name), target_year, target_month, options)
16 17 end
17 18
18 19 def link_to_next_month(year, month, options={})
19 20 target_year, target_month = if month == 12
20 21 [year + 1, 1]
21 22 else
22 23 [year, month + 1]
23 24 end
24 25
25 26 name = if target_month == 1
26 27 "#{month_name(target_month)} #{target_year}"
27 28 else
28 29 "#{month_name(target_month)}"
29 30 end
30 31
31 link_to_month((name + ' »'), target_year, target_month, options)
32 # \xc2\xbb(utf-8) = »
33 link_to_month((name + " \xc2\xbb"), target_year, target_month, options)
32 34 end
33 35
34 36 def link_to_month(link_name, year, month, options={})
35 37 link_to_content_update(h(link_name), params.merge(:year => year, :month => month))
36 38 end
37 39 end
General Comments 0
You need to be logged in to leave comments. Login now