Fix dnd & drag resize of non-recurring events

This commit is contained in:
Nathan Gray 2015-11-30 17:21:40 +00:00
parent 6df97ceae1
commit e191075303
4 changed files with 8 additions and 10 deletions

View File

@ -814,7 +814,7 @@ app.classes.calendar = AppJS.extend(
'calendar.calendar_uiforms.ajax_moveEvent', 'calendar.calendar_uiforms.ajax_moveEvent',
[widget.options.value.id, widget.options.value.owner, widget.options.value.start, widget.options.value.owner, widget.options.value.duration], [widget.options.value.id, widget.options.value.owner, widget.options.value.start, widget.options.value.owner, widget.options.value.duration],
// Remove loading spinner // Remove loading spinner
function() {widget.div.removeClass('loading');} function() {if(widget && widget.div) widget.div.removeClass('loading');}
).sendRequest(true); ).sendRequest(true);
} }
}, },

View File

@ -421,8 +421,8 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM],
{ {
var node = this._children[this._children.length-1]; var node = this._children[this._children.length-1];
this.removeChild(node); this.removeChild(node);
node.free(); node.free();
} }
// Make sure children are in cronological order, or columns are backwards // Make sure children are in cronological order, or columns are backwards
events.sort(function(a,b) { events.sort(function(a,b) {

View File

@ -174,8 +174,6 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
// Copy new information // Copy new information
this.options.value = event; this.options.value = event;
var eventId = event.id.match(/-?\d+\.?\d*/g)[0];
var appName = event.id.replace(/-?\d+\.?\d*/g,'');
var app_id = event.app_id ? event.app_id : event.id + (event.recur_type ? ':'+event.recur_date : ''); var app_id = event.app_id ? event.app_id : event.id + (event.recur_type ? ':'+event.recur_date : '');
this._parent.date_helper.set_value(event.start.valueOf ? new Date(event.start) : event.start); this._parent.date_helper.set_value(event.start.valueOf ? new Date(event.start) : event.start);
var formatted_start = this._parent.date_helper.getValue(); var formatted_start = this._parent.date_helper.getValue();
@ -208,8 +206,8 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
.attr('data-draggable-id',event['id']+'_O'+event.owner+'_C'+(event.owner<0?'group'+Math.abs(event.owner):event.owner)) .attr('data-draggable-id',event['id']+'_O'+event.owner+'_C'+(event.owner<0?'group'+Math.abs(event.owner):event.owner))
// Put everything we need for basic interaction here, so it's available immediately // Put everything we need for basic interaction here, so it's available immediately
.attr('data-id', eventId || event.id) .attr('data-id', event.id)
.attr('data-app', appName || 'calendar') .attr('data-app', event.app || 'calendar')
.attr('data-app_id', app_id) .attr('data-app_id', app_id)
.attr('data-start', formatted_start) .attr('data-start', formatted_start)
.attr('data-owner', event.owner) .attr('data-owner', event.owner)

View File

@ -238,7 +238,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
e.originalEvent = event; e.originalEvent = event;
e.data = {duration: 0}; e.data = {duration: 0};
var event_data = timegrid._get_event_info(this); var event_data = timegrid._get_event_info(this);
var event_widget = timegrid.getWidgetById('event_'+event_data.id); var event_widget = timegrid.getWidgetById('event_'+event_data.app_id);
var sT = event_widget.options.value.start_m; var sT = event_widget.options.value.start_m;
if (typeof this.dropEnd != 'undefined' && this.dropEnd.length == 1) if (typeof this.dropEnd != 'undefined' && this.dropEnd.length == 1)
{ {
@ -376,7 +376,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
if(!event_widget) if(!event_widget)
{ {
// Widget was moved across weeks / owners // Widget was moved across weeks / owners
event_widget = timegrid.getParent().getWidgetById('event_'+event_data.id); event_widget = timegrid.getParent().getWidgetById('event_'+event_data.app_id);
} }
if(event_widget) if(event_widget)
{ {
@ -1381,7 +1381,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
if (this.onevent_change) if (this.onevent_change)
{ {
var event_data = this._get_event_info(dom_node); var event_data = this._get_event_info(dom_node);
var event_widget = this.getWidgetById('event_'+event_data.id); var event_widget = this.getWidgetById('event_'+event_data.app_id);
et2_calendar_event.recur_prompt(event_data, jQuery.proxy(function(button_id, event_data) { et2_calendar_event.recur_prompt(event_data, jQuery.proxy(function(button_id, event_data) {
// No need to continue // No need to continue
if(button_id === 'cancel') return false; if(button_id === 'cancel') return false;