Feature #27096 » 0001-Move-calendar-day-classes-to-a-helper.patch
app/helpers/calendars_helper.rb | ||
---|---|---|
55 | 55 |
def link_to_month(link_name, year, month, options={}) |
56 | 56 |
link_to(link_name, {:params => request.query_parameters.merge(:year => year, :month => month)}, options) |
57 | 57 |
end |
58 | ||
59 |
def calendar_day_css_classes(calendar, day) |
|
60 |
css = day.month==calendar.month ? 'even' : 'odd' |
|
61 |
css << " today" if User.current.today == day |
|
62 |
css |
|
63 |
end |
|
58 | 64 |
end |
app/views/common/_calendar.html.erb | ||
---|---|---|
8 | 8 |
<% day = calendar.startdt |
9 | 9 |
while day <= calendar.enddt %> |
10 | 10 |
<%= ("<td class='week-number' title='#{ l(:label_week) }'>#{(day+(11-day.cwday)%7).cweek}</td>".html_safe) if day.cwday == calendar.first_wday %> |
11 |
<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if User.current.today == day %>">
|
|
11 |
<td class="<%= calendar_day_css_classes(calendar, day) %>">
|
|
12 | 12 |
<p class="day-num"><%= day.day %></p> |
13 | 13 |
<% calendar.events_on(day).each do |i| %> |
14 | 14 |
<% if i.is_a? Issue %> |