Project

General

Profile

Feature #27096 » 0001-Move-calendar-day-classes-to-a-helper.patch

Marius BĂLTEANU, 2018-12-18 07:37

View differences:

app/helpers/calendars_helper.rb
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
app/views/common/_calendar.html.erb
<% 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 %>
(2-2/3)