Fix some issues in drag and drop CSS with resizing on drop

This commit is contained in:
Nathan Gray 2015-12-09 20:54:01 +00:00
parent d9b43423a7
commit e7fd0ff52a
3 changed files with 37 additions and 3 deletions

View File

@ -611,7 +611,7 @@ app.classes.calendar = AppJS.extend(
// Re-scroll to start of day
template.widgetContainer.iterateOver(function(w) {
w._resizeTimes();
w.resizeTimes();
},this, et2_calendar_timegrid);
window.setTimeout(function() {

View File

@ -686,9 +686,14 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM],
{
if(!this.all_day.has(columns[c][i].div).length)
{
columns[c][i].div.css('top', '');
columns[c][i].div.css('height','');
columns[c][i].div.css('left', '');
columns[c][i].div.css('width', '');
columns[c][i].body.css('padding-top','');
columns[c][i].div
.appendTo(this.all_day);
this._parent._resizeTimes();
this._parent.resizeTimes();
}
continue;
}
@ -697,7 +702,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM],
if(this.all_day.has(columns[c][i].div).length)
{
columns[c][i].div.appendTo(this.div);
this._parent._resizeTimes();
this._parent.resizeTimes();
}
top = this._time_to_position(columns[c][i].options.value.start_m,whole_day_counter);
height = this._time_to_position(columns[c][i].options.value.end_m,whole_day_counter)-top;

View File

@ -175,6 +175,10 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
{
window.clearTimeout(this.update_timer);
}
if(this.resize_timer)
{
window.clearTimeout(this.resize_timer);
}
},
doLoadingFinished: function() {
@ -683,6 +687,26 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
this.scrolling.scrollTop(this._top_time);
},
/**
* As window size and number of all day non-blocking events change, we need
* to re-scale the time grid to make sure the full working day is shown.
*
*/
resizeTimes: function() {
// Wait a bit to see if anything else changes, then re-draw the times
if(this.resize_timer === null)
{
this.resize_timer = window.setTimeout(jQuery.proxy(function() {
if(this._resize_times)
{
this.resize_timer = null;
this._resizeTimes();
}
},this),1);
}
},
_resizeTimes: function() {
var wd_start = 60*this.options.day_start;
@ -932,6 +956,11 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
_data.ui.draggable.on('dragend.et2_timegrid'+widget_object.id, function() {
_data.ui.draggable.off('drag.et2_timegrid' + widget_object.id);
});
// Remove formatting for out-of-view events (full day non-blocking)
$j('.calendar_calEventHeader',_data.ui.helper).css('top','');
$j('.calendar_calEventBody',_data.ui.helper).css('padding-top','');
if(time.length)
{
// The out will trigger after the over, so we count