##// 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
@@ -10,14 +10,7
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">
General Comments 0
You need to be logged in to leave comments. Login now