@@ -1,42 +1,44 | |||||
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 | |
6 | [year, month - 1] |
|
6 | [year, month - 1] | |
7 | end |
|
7 | end | |
8 |
|
8 | |||
9 | name = if target_month == 12 |
|
9 | name = if target_month == 12 | |
10 | "#{month_name(target_month)} #{target_year}" |
|
10 | "#{month_name(target_month)} #{target_year}" | |
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 | |
26 | [year, month + 1] |
|
27 | [year, month + 1] | |
27 | end |
|
28 | end | |
28 |
|
29 | |||
29 | name = if target_month == 1 |
|
30 | name = if target_month == 1 | |
30 | "#{month_name(target_month)} #{target_year}" |
|
31 | "#{month_name(target_month)} #{target_year}" | |
31 | else |
|
32 | else | |
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}, | |
39 | {:href => link_target}) |
|
41 | {:href => link_target}) | |
40 |
|
42 | |||
41 | end |
|
43 | end | |
42 | end |
|
44 | end |
@@ -1,50 +1,50 | |||||
1 | <h2><%= l(:label_calendar) %></h2> |
|
1 | <h2><%= l(:label_calendar) %></h2> | |
2 |
|
2 | |||
3 | <% form_tag(calendar_path, :method => :put, :id => 'query_form') do %> |
|
3 | <% form_tag(calendar_path, :method => :put, :id => 'query_form') do %> | |
4 | <%= hidden_field_tag('project_id', @project.to_param) if @project%> |
|
4 | <%= hidden_field_tag('project_id', @project.to_param) if @project%> | |
5 | <fieldset id="filters" class="collapsible"> |
|
5 | <fieldset id="filters" class="collapsible"> | |
6 | <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> |
|
6 | <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> | |
7 | <div> |
|
7 | <div> | |
8 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> |
|
8 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> | |
9 | </div> |
|
9 | </div> | |
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"> | |
17 | <%= label_tag('month', l(:label_month)) %> |
|
17 | <%= label_tag('month', l(:label_month)) %> | |
18 | <%= select_month(@month, :prefix => "month", :discard_type => true) %> |
|
18 | <%= select_month(@month, :prefix => "month", :discard_type => true) %> | |
19 | <%= label_tag('year', l(:label_year)) %> |
|
19 | <%= label_tag('year', l(:label_year)) %> | |
20 | <%= select_year(@year, :prefix => "year", :discard_type => true) %> |
|
20 | <%= select_year(@year, :prefix => "year", :discard_type => true) %> | |
21 |
|
21 | |||
22 | <%= link_to_remote l(:button_apply), |
|
22 | <%= link_to_remote l(:button_apply), | |
23 | { :url => { :set_filter => (@query.new_record? ? 1 : nil) }, |
|
23 | { :url => { :set_filter => (@query.new_record? ? 1 : nil) }, | |
24 | :update => "content", |
|
24 | :update => "content", | |
25 | :with => "Form.serialize('query_form')" |
|
25 | :with => "Form.serialize('query_form')" | |
26 | }, :class => 'icon icon-checked' %> |
|
26 | }, :class => 'icon icon-checked' %> | |
27 |
|
27 | |||
28 | <%= link_to_remote l(:button_clear), |
|
28 | <%= link_to_remote l(:button_clear), | |
29 | { :url => { :set_filter => (@query.new_record? ? 1 : nil) }, |
|
29 | { :url => { :set_filter => (@query.new_record? ? 1 : nil) }, | |
30 | :update => "content", |
|
30 | :update => "content", | |
31 | }, :class => 'icon icon-reload' if @query.new_record? %> |
|
31 | }, :class => 'icon icon-reload' if @query.new_record? %> | |
32 | </p> |
|
32 | </p> | |
33 | <% end %> |
|
33 | <% end %> | |
34 |
|
34 | |||
35 | <%= error_messages_for 'query' %> |
|
35 | <%= error_messages_for 'query' %> | |
36 | <% if @query.valid? %> |
|
36 | <% if @query.valid? %> | |
37 | <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %> |
|
37 | <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %> | |
38 |
|
38 | |||
39 | <p class="legend cal"> |
|
39 | <p class="legend cal"> | |
40 | <span class="starting"><%= l(:text_tip_task_begin_day) %></span> |
|
40 | <span class="starting"><%= l(:text_tip_task_begin_day) %></span> | |
41 | <span class="ending"><%= l(:text_tip_task_end_day) %></span> |
|
41 | <span class="ending"><%= l(:text_tip_task_end_day) %></span> | |
42 | <span class="starting ending"><%= l(:text_tip_task_begin_end_day) %></span> |
|
42 | <span class="starting ending"><%= l(:text_tip_task_begin_end_day) %></span> | |
43 | </p> |
|
43 | </p> | |
44 | <% end %> |
|
44 | <% end %> | |
45 |
|
45 | |||
46 | <% content_for :sidebar do %> |
|
46 | <% content_for :sidebar do %> | |
47 | <%= render :partial => 'issues/sidebar' %> |
|
47 | <%= render :partial => 'issues/sidebar' %> | |
48 | <% end %> |
|
48 | <% end %> | |
49 |
|
49 | |||
50 | <% html_title(l(:label_calendar)) -%> |
|
50 | <% html_title(l(:label_calendar)) -%> |
General Comments 0
You need to be logged in to leave comments.
Login now