Skip to content

Commit

Permalink
Fix refreshing resources for multiday events.
Browse files Browse the repository at this point in the history
This fixes cases such as drag/dropping the event, but grabbing it
from an event bubble other than the first one of a multi-day event.
  • Loading branch information
mrubinsk committed Aug 31, 2014
1 parent 244133d commit c495aa2
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions kronolith/js/kronolith.js
Expand Up @@ -5309,7 +5309,13 @@ KronolithCore = {
}, this);
}
this.loadEventsCallback(r, false);
this.refreshResources(newDate.toString('yyyyMMdd'), cal, eventid, lastDate.toString('yyyyMMdd'));
$H(r.events).each(function(days) {
$H(days.value).each(function(event) {
if (event.key == eventid) {
this.refreshResources(days.key, cal, eventid, lastDate.toString('yyyyMMdd'), event);
}
}.bind(this))
}.bind(this));
}.bind(this);

if (event.value.mt) {
Expand Down Expand Up @@ -5531,21 +5537,28 @@ KronolithCore = {
event = events.find(function(e) { return e.key == eventid; });
}
if (!dt) {
dt = event.value.start.toString('yyyyMMdd');
dt = new Date(event.value.s).toString('yyyyMMdd');
}
dates = this.viewDates(this.parseDate(dt), this.view);
if (event) {
$H(event.value.rs).each(function(r) {
var r_cal = ['resource', r.value.calendar],
r_events = this.getCacheForDate(last_dt, r_cal.join('|')),
r_event, day;
r_event, day, end;

if (r_events) {
r_event = r_events.find(function(e) { return e.value.uid == event.value.uid });
if (r_event) {
this.removeEvent(r_cal, r_event.key);
day = event.value.start.clone();
end = event.value.end.clone().add(1).day();
day = new Date(r_event.value.s);
end = new Date(r_event.value.s);
while (!day.isAfter(end)) {
this.deleteCache(r_cal, null, day.toString('yyyyMMdd'));
day.add(1).day();
}
day = new Date(event.value.s);
end = new Date(event.value.e);

while (!day.isAfter(end)) {
this.deleteCache(r_cal, null, day.toString('yyyyMMdd'));
day.add(1).day();
Expand Down

0 comments on commit c495aa2

Please sign in to comment.