##// END OF EJS Templates
Refactor: extract link to previous and next month into helpers....
Eric Davis -
r3928:3eea03d70efd
parent child
Show More
@@ -0,0 +1,14
1 module CalendarsHelper
2 def link_to_previous_month(year, month)
3 link_to_remote ('« ' + (month==1 ? "#{month_name(12)} #{year-1}" : "#{month_name(month-1)}")),
4 {:update => "content", :url => { :year => (month==1 ? year-1 : year), :month =>(month==1 ? 12 : month-1) }},
5 {:href => url_for(:action => 'show', :year => (month==1 ? year-1 : year), :month =>(month==1 ? 12 : month-1))}
6 end
7
8 def link_to_next_month(year, month)
9 link_to_remote ((month==12 ? "#{month_name(1)} #{year+1}" : "#{month_name(month+1)}") + ' »'),
10 {:update => "content", :url => { :year => (month==12 ? year+1 : year), :month =>(month==12 ? 1 : month+1) }},
11 {:href => url_for(:action => 'show', :year => (month==12 ? year+1 : year), :month =>(month==12 ? 1 : month+1))}
12
13 end
14 end
@@ -1,57 +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_remote ('&#171; ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
13 <%= link_to_previous_month(@year, @month) %> | <%= link_to_next_month(@year, @month) %>
14 {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }},
15 {:href => url_for(:action => 'show', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}
16 %> |
17 <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' &#187;'),
18 {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }},
19 {:href => url_for(:action => 'show', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}
20 %>
21 </p>
14 </p>
22
15
23 <p class="buttons">
16 <p class="buttons">
24 <%= label_tag('month', l(:label_month)) %>
17 <%= label_tag('month', l(:label_month)) %>
25 <%= select_month(@month, :prefix => "month", :discard_type => true) %>
18 <%= select_month(@month, :prefix => "month", :discard_type => true) %>
26 <%= label_tag('year', l(:label_year)) %>
19 <%= label_tag('year', l(:label_year)) %>
27 <%= select_year(@year, :prefix => "year", :discard_type => true) %>
20 <%= select_year(@year, :prefix => "year", :discard_type => true) %>
28
21
29 <%= link_to_remote l(:button_apply),
22 <%= link_to_remote l(:button_apply),
30 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
23 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
31 :update => "content",
24 :update => "content",
32 :with => "Form.serialize('query_form')"
25 :with => "Form.serialize('query_form')"
33 }, :class => 'icon icon-checked' %>
26 }, :class => 'icon icon-checked' %>
34
27
35 <%= link_to_remote l(:button_clear),
28 <%= link_to_remote l(:button_clear),
36 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
29 { :url => { :set_filter => (@query.new_record? ? 1 : nil) },
37 :update => "content",
30 :update => "content",
38 }, :class => 'icon icon-reload' if @query.new_record? %>
31 }, :class => 'icon icon-reload' if @query.new_record? %>
39 </p>
32 </p>
40 <% end %>
33 <% end %>
41
34
42 <%= error_messages_for 'query' %>
35 <%= error_messages_for 'query' %>
43 <% if @query.valid? %>
36 <% if @query.valid? %>
44 <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
37 <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
45
38
46 <p class="legend cal">
39 <p class="legend cal">
47 <span class="starting"><%= l(:text_tip_task_begin_day) %></span>
40 <span class="starting"><%= l(:text_tip_task_begin_day) %></span>
48 <span class="ending"><%= l(:text_tip_task_end_day) %></span>
41 <span class="ending"><%= l(:text_tip_task_end_day) %></span>
49 <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>
50 </p>
43 </p>
51 <% end %>
44 <% end %>
52
45
53 <% content_for :sidebar do %>
46 <% content_for :sidebar do %>
54 <%= render :partial => 'issues/sidebar' %>
47 <%= render :partial => 'issues/sidebar' %>
55 <% end %>
48 <% end %>
56
49
57 <% 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