I'm calling the helper method from view like this -
%th{:class => weekend_class_top(date)}= date.strftime("%d")
helper method which has been called -
def weekend_class_top(date)
if (date == date.end_of_month)
'weekend_color5'
elsif (date.to_s(:weekend) == 'Sun')
'weekend_color3'
elsif @holidays.any?
@holidays.map.each do |holiday|
if (date == holiday)
'timesheet_holiday_color'
end
end
elsif @user_leaves.any?
@user_leaves.flatten.map.each do |leave|
if (date == leave)
'timesheet_leave_color'
end
end
end
end
I want to show different background color for holidays and leaves, but the code that I have written, I'm getting background color only for holidays not leaves.
Aucun commentaire:
Enregistrer un commentaire