- Fix drag & drop an event inside a group or consolidated calendar asked to move or invite

- Fix some drag to create bugs throwing errors
This commit is contained in:
nathangray 2016-07-11 15:23:11 -06:00
parent 3a2ac5402d
commit 983cfab70d
3 changed files with 29 additions and 6 deletions

View File

@ -307,6 +307,9 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
.css('top', '').css('left','')
.appendTo(ui.helper);
ui.helper.width(jQuery(this).width());
// Cancel drag to create, we're dragging an existing event
planner._drag_create_end();
});
return true;
},
@ -1910,6 +1913,7 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
{
var time = this._get_time_from_position(event.offsetX, event.offsetY);
}
if(!time) return false;
this.div.css('cursor', 'ew-resize');

View File

@ -1091,8 +1091,14 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
var event = event.iface.getWidget();
var timegrid = target.iface.getWidget() || false;
if(event === timegrid || !event || !timegrid ||
!event.options || !event.options.value.participants || !timegrid.options.owner ) return false;
!event.options || !event.options.value.participants || !timegrid.options.owner
)
{
return false;
}
var owner_match = false;
var own_timegrid = event.getParent().getParent() === timegrid && !timegrid.daily_owner;
for(var id in event.options.value.participants)
{
if(!timegrid.daily_owner)
@ -1111,11 +1117,15 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
if(col.div.has(timegrid.gridHover).length || col.header.has(timegrid.gridHover).length)
{
owner_match = owner_match || col.options.owner.indexOf(id) !== -1;
own_timegrid = (col === event.getParent());
}
}, this, et2_calendar_daycol);
}
}
var enabled = !owner_match;
var enabled = !owner_match &&
// Not inside its own timegrid
!own_timegrid;
widget_object.getActionLink('invite').enabled = enabled;
widget_object.getActionLink('change_participant').enabled = enabled;

View File

@ -414,7 +414,10 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
// Clear some stuff, if last time did not complete
if(this.drag_create.event)
{
this.drag_create.event.destroy();
if(this.drag_create.event.destroy)
{
this.drag_create.event.destroy();
}
this.drag_create.event = null;
}
// Wait a bit before adding an "event", it may be just a click
@ -467,7 +470,7 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
_drag_update_event: function()
{
if(!this.drag_create.event || !this.drag_create.start || !this.drag_create.end
|| !this.drag_create.parent)
|| !this.drag_create.parent || !this.drag_create.event._type)
{
return;
}
@ -540,7 +543,10 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
this.drag_create.parent = null;
if(this.drag_create.event)
{
this.drag_create.event.destroy();
if(this.drag_create.event.destroy)
{
this.drag_create.event.destroy();
}
this.drag_create.event = null;
}
},this),100);
@ -553,7 +559,10 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
this.drag_create.parent = null;
if(this.drag_create.event)
{
this.drag_create.event.destroy();
if(this.drag_create.event.destroy)
{
this.drag_create.event.destroy();
}
this.drag_create.event = null;
}
return true;