@@ -1,39 +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 | 15 | # \xc2\xab(utf-8) = « |
|
16 | 16 | link_to_month(("\xc2\xab " + name), target_year, target_month, options) |
|
17 | 17 | end |
|
18 | 18 | |
|
19 | 19 | def link_to_next_month(year, month, options={}) |
|
20 | 20 | target_year, target_month = if month == 12 |
|
21 | 21 | [year + 1, 1] |
|
22 | 22 | else |
|
23 | 23 | [year, month + 1] |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | 26 | name = if target_month == 1 |
|
27 | 27 | "#{month_name(target_month)} #{target_year}" |
|
28 | 28 | else |
|
29 | 29 | "#{month_name(target_month)}" |
|
30 | 30 | end |
|
31 | 31 | |
|
32 | 32 | # \xc2\xbb(utf-8) = » |
|
33 | 33 | link_to_month((name + " \xc2\xbb"), target_year, target_month, options) |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | def link_to_month(link_name, year, month, options={}) |
|
37 | 37 | link_to_content_update(h(link_name), params.merge(:year => year, :month => month)) |
|
38 | 38 | end |
|
39 | 39 | end |
General Comments 0
You need to be logged in to leave comments.
Login now