From 9c0c01e230218d4e7a36fc10b49fd6f6bb80bbf2 Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Sun, 16 Dec 2018 22:13:10 +0000 Subject: [PATCH 1/2] Move calendar day classes to a helper --- app/helpers/calendars_helper.rb | 6 ++++++ app/views/common/_calendar.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb index 715667c..a807ec4 100644 --- a/app/helpers/calendars_helper.rb +++ b/app/helpers/calendars_helper.rb @@ -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 diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb index 852ab52..dce3c8b 100644 --- a/app/views/common/_calendar.html.erb +++ b/app/views/common/_calendar.html.erb @@ -8,7 +8,7 @@ <% day = calendar.startdt while day <= calendar.enddt %> <%= ("#{(day+(11-day.cwday)%7).cweek}".html_safe) if day.cwday == calendar.first_wday %> - +

<%= day.day %>

<% calendar.events_on(day).each do |i| %> <% if i.is_a? Issue %> -- 2.1.4