I am using a jquery UI DatePicker widget to show a calendar. Each day in the calendar is represented by a collection of Result object, which belong to an Objective model. If all the results for a day are succesful, I'm setting a class on the calendar cell, to make it green. If at least one of them failed, I'm making it red. If no results exists, I'm making it grey. Right now , I do something like this:
<%= start_day .. end_day do |day| %>
<div class="hidethis" id="<%= [day.year,day.month,day.year].join(",") %>" value="<%= objective.result_status_for_day(day)%>"/>
<% end %>
I am storing data in hidden divs, and later, when I'm initializing the calendar, in the beforeShowDay I'm going through the div ids to find the one relevant to me, and I set the class responsible for colouring the cell. Is there another way of doing this, or is this something which other people use in practice?