- Fix broken drag to resize

- Fix single day was sometimes too wide
This commit is contained in:
Nathan Gray 2016-01-19 18:03:42 +00:00
parent df0592f7c8
commit 14041ccde4
4 changed files with 24 additions and 13 deletions

View File

@ -143,7 +143,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
{
return this.all_day[0];
}
return this.event_wrapper[0];
return this.div[0];
}
},

View File

@ -249,6 +249,14 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
// Get CSS too
egw.includeCSS('/phpgwapi/categories.php?app='+event.app);
// Need cleaning? (DnD helper removes content)
if(!this.div.has(this.title).length)
{
this.div
.empty()
.append(this.title)
.append(this.body);
}
// DOM nodes
this.div
// Let timegrid always get the drag

View File

@ -175,7 +175,7 @@ var et2_calendar_planner = et2_calendar_view.extend([et2_IDetachedDOM, et2_IResi
e.originalEvent = event;
e.data = {duration: 0};
var event_data = planner._get_event_info(this);
var event_widget = planner.getWidgetById('event_'+event_data.id);
var event_widget = planner.getWidgetById(event_data.widget_id);
var sT = event_widget.options.value.start_m;
if (typeof this.dropEnd != 'undefined')
{
@ -1670,7 +1670,7 @@ var et2_calendar_planner = et2_calendar_view.extend([et2_IDetachedDOM, et2_IResi
if (this.onevent_change)
{
var event_data = this._get_event_info(dom_node);
var event_widget = this.getWidgetById('event_'+event_data.id);
var event_widget = this.getWidgetById(event_data.widget_id);
et2_calendar_event.recur_prompt(event_data, jQuery.proxy(function(button_id, event_data) {
// No need to continue
if(button_id === 'cancel') return false;

View File

@ -235,7 +235,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
e.originalEvent = event;
e.data = {duration: 0};
var event_data = timegrid._get_event_info(this);
var event_widget = timegrid.getWidgetById('event_'+event_data.app_id);
var event_widget = timegrid.getWidgetById(event_data.widget_id);
var sT = event_widget.options.value.start_m;
if (typeof this.dropEnd != 'undefined' && this.dropEnd.length == 1)
{
@ -562,9 +562,14 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
// Add the binding for the change handler
$j(this.div).on("change.et2_calendar_timegrid", '*:not(.calendar_calEvent)', this, function(e) {
return e.data.change.call(e.data, e, this);
});
return e.data.change.call(e.data, e, this);
});
// Catch resize and prevent it from bubbling further, triggering
// etemplate's resize
this.div.on('resize', this, function(e) {
e.stopPropagation();
});
},
getDOMNode: function(_sender) {
@ -865,9 +870,6 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
}
this.day_widgets.splice(delete_index--,1);
}
// Adjust and scroll to start of day
this.resizeTimes();
// Create / update day widgets with dates and data
for(var i = 0; i < this.day_widgets.length; i++)
@ -894,6 +896,9 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
}
day.set_width(day_width + 'px');
}
// Adjust and scroll to start of day
this.resizeTimes();
// Don't hold on to value any longer, use the data cache for best info
this.value = {};
@ -1472,7 +1477,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
if (this.onevent_change)
{
var event_data = this._get_event_info(dom_node);
var event_widget = this.getWidgetById('event_'+event_data.app_id);
var event_widget = this.getWidgetById(event_data.widget_id);
et2_calendar_event.recur_prompt(event_data, jQuery.proxy(function(button_id, event_data) {
// No need to continue
if(button_id === 'cancel') return false;
@ -1697,9 +1702,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
}
// Try to resize width, though animations cause problems
var total_width = Math.min(this.div.width(),( $j(this.getInstanceManager().DOMContainer).width() - (
this.days.innerWidth() ? this.div.innerWidth() - this.days.innerWidth() : 0
)));
var total_width = this.days.width();
var day_width = (total_width > 0 ? total_width : $j(this.getInstanceManager().DOMContainer).width())/this.day_widgets.length;
// update day widgets
for(var i = 0; i < this.day_widgets.length; i++)