@@ -1,5 +1,5 | |||
|
1 | 1 | module CalendarsHelper |
|
2 | def link_to_previous_month(year, month) | |
|
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 |
@@ -11,15 +11,16 module CalendarsHelper | |||
|
11 | 11 | else |
|
12 | 12 | "#{month_name(target_month)}" |
|
13 | 13 | end |
|
14 | ||
|
15 | link_target = calendar_path(:year => target_year, :month => target_month) | |
|
14 | ||
|
15 | project_id = options[:project].present? ? options[:project].to_param : nil | |
|
16 | link_target = calendar_path(:year => target_year, :month => target_month, :project_id => project_id) | |
|
16 | 17 | |
|
17 | 18 | link_to_remote(('« ' + name), |
|
18 | 19 | {:update => "content", :url => link_target, :method => :put}, |
|
19 | 20 | {:href => link_target}) |
|
20 | 21 | end |
|
21 | 22 | |
|
22 | def link_to_next_month(year, month) | |
|
23 | def link_to_next_month(year, month, options={}) | |
|
23 | 24 | target_year, target_month = if month == 12 |
|
24 | 25 | [year + 1, 1] |
|
25 | 26 | else |
@@ -32,7 +33,8 module CalendarsHelper | |||
|
32 | 33 | "#{month_name(target_month)}" |
|
33 | 34 | end |
|
34 | 35 | |
|
35 | link_target = calendar_path(:year => target_year, :month => target_month) | |
|
36 | project_id = options[:project].present? ? options[:project].to_param : nil | |
|
37 | link_target = calendar_path(:year => target_year, :month => target_month, :project_id => project_id) | |
|
36 | 38 | |
|
37 | 39 | link_to_remote((name + ' »'), |
|
38 | 40 | {:update => "content", :url => link_target, :method => :put}, |
@@ -10,7 +10,7 | |||
|
10 | 10 | </fieldset> |
|
11 | 11 | |
|
12 | 12 | <p style="float:right;"> |
|
13 | <%= link_to_previous_month(@year, @month) %> | <%= link_to_next_month(@year, @month) %> | |
|
13 | <%= link_to_previous_month(@year, @month, :project => @project) %> | <%= link_to_next_month(@year, @month, :project => @project) %> | |
|
14 | 14 | </p> |
|
15 | 15 | |
|
16 | 16 | <p class="buttons"> |
General Comments 0
You need to be logged in to leave comments.
Login now