Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
fix(weekViewWithTimes): put events in the correct columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Lewis committed Jun 29, 2016
1 parent eb72854 commit 06b0181
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/services/calendarHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ angular
var flattenedEvents = [];
weekView.eventRows.forEach(function(row) {
row.row.forEach(function(eventRow) {
eventRow.event.dayOffset = eventRow.offset;
flattenedEvents.push(eventRow.event);
});
});
Expand All @@ -331,7 +332,9 @@ angular
});
weekView.eventRows = [{
row: newEvents.map(function(event) {
return {event: event};
var offset = event.dayOffset;
delete event.dayOffset;
return {event: event, offset: offset};
})
}];
return weekView;
Expand Down
2 changes: 1 addition & 1 deletion src/templates/calendarWeekView.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}">
<div
class="day-highlight"
ng-class="['dh-event-' + eventRow.event.type, eventRow.event.cssClass, eventRow.extendsLeft ? '' : 'border-left-rounded', eventRow.extendsRight ? '' : 'border-right-rounded']"
ng-class="['dh-event-' + eventRow.event.type, eventRow.event.cssClass, !vm.showTimes && eventRow.extendsLeft ? '' : 'border-left-rounded', !vm.showTimes && eventRow.extendsRight ? '' : 'border-right-rounded']"
data-event-class
mwl-draggable="eventRow.event.draggable === true"
axis="vm.showTimes ? 'xy' : 'x'"
Expand Down
9 changes: 6 additions & 3 deletions test/unit/services/calendarHelper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ describe('calendarHelper', function() {
left: 0,
startsAt: new Date('October 19, 2015 11:00:00'),
endsAt: new Date('October 21, 2015 11:00:00')
}
},
offset: 1
},
{
event: {
Expand All @@ -636,7 +637,8 @@ describe('calendarHelper', function() {
left: 0,
startsAt: new Date('October 20, 2015 11:00:00'),
endsAt: new Date('October 21, 2015 11:00:00')
}
},
offset: 2
},
{
event: {
Expand All @@ -645,7 +647,8 @@ describe('calendarHelper', function() {
top: 658,
height: 60,
left: 150
}
},
offset: 2
}
];

Expand Down

0 comments on commit 06b0181

Please sign in to comment.