Browse Source

Move calendar day classes to a helper (#27096).

Patch by Marius BALTEANU.


git-svn-id: http://svn.redmine.org/redmine/trunk@17797 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Go MAEDA 5 years ago
parent
commit
fdf468cdf7
2 changed files with 7 additions and 1 deletions
  1. 6
    0
      app/helpers/calendars_helper.rb
  2. 1
    1
      app/views/common/_calendar.html.erb

+ 6
- 0
app/helpers/calendars_helper.rb View File

@@ -55,4 +55,10 @@ module CalendarsHelper
def link_to_month(link_name, year, month, options={})
link_to(link_name, {:params => request.query_parameters.merge(:year => year, :month => month)}, options)
end

def calendar_day_css_classes(calendar, day)
css = day.month==calendar.month ? 'even' : 'odd'
css << " today" if User.current.today == day
css
end
end

+ 1
- 1
app/views/common/_calendar.html.erb View File

@@ -8,7 +8,7 @@
<% day = calendar.startdt
while day <= calendar.enddt %>
<%= ("<td class='week-number' title='#{ l(:label_week) }'>#{(day+(11-day.cwday)%7).cweek}</td>".html_safe) if day.cwday == calendar.first_wday %>
<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if User.current.today == day %>">
<td class="<%= calendar_day_css_classes(calendar, day) %>">
<p class="day-num"><%= day.day %></p>
<% calendar.events_on(day).each do |i| %>
<% if i.is_a? Issue %>

Loading…
Cancel
Save