Fix day header coloring from other months was kept when the week was reused

This commit is contained in:
nathangray 2016-09-01 10:36:43 -06:00
parent b86dfa52bb
commit 78593797c9
2 changed files with 27 additions and 11 deletions

View File

@ -2254,6 +2254,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
// Do not need to re-set this row, but we do need to re-do
// the times, as they may have changed
widget.resizeTimes();
window.setTimeout(jQuery.proxy(widget.set_header_classes, widget),0);
// Hide loader
widget.loader.hide();

View File

@ -935,22 +935,13 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
this.day_widgets.splice(delete_index--,1);
}
this.set_header_classes();
// Create / update day widgets with dates and data
for(var i = 0; i < this.day_widgets.length; i++)
{
day = this.day_widgets[i];
// Classes
if(app.calendar && app.calendar.state &&
this.day_list[i] && parseInt(this.day_list[i].substr(4,2)) !== new Date(app.calendar.state.date).getUTCMonth()+1)
{
day.set_class('calendar_differentMonth');
}
else
{
day.set_class('');
}
// Position
day.set_left((day_width * i) + 'px');
if(this.daily_owner)
@ -1000,6 +991,30 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
*/
},
/**
* Set header classes
*
*/
set_header_classes: function()
{
var day;
for(var i = 0; i < this.day_widgets.length; i++)
{
day = this.day_widgets[i];
// Classes
if(app.calendar && app.calendar.state &&
this.day_list[i] && parseInt(this.day_list[i].substr(4,2)) !== new Date(app.calendar.state.date).getUTCMonth()+1)
{
day.set_class('calendar_differentMonth');
}
else
{
day.set_class('');
}
}
},
/**
* Update UI while scrolling within the selected time
*