To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 15 / 15d89251506baa28cfc583d29fd309d36051242b.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (2.05 KB)
| 1 | 1296:038ba2d95de8 | Chris | # encoding: utf-8 |
|---|---|---|---|
| 2 | # |
||
| 3 | # Redmine - project management software |
||
| 4 | # Copyright (C) 2006-2012 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 |