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