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