Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

feat(weekView): allow external events to be dropped on week column he…

…aders

First part of #284
  • Loading branch information...
Matt Lewis
Matt Lewis committed Feb 13, 2016
1 parent e112186 commit 1ea99a3cfe793d0c09b7a74e2aa5106b2a31fd4f
@@ -51,6 +51,11 @@ angular
});
};

vm.eventDropped = function(event, date) {
var daysDiff = moment(date).diff(moment(event.startsAt), 'days');
vm.weekDragged(event, daysDiff);
};

vm.weekResized = function(event, edge, daysDiff) {

var start = moment(event.startsAt);
@@ -15,7 +15,11 @@
.cal-month-day {
height: @rowHeightMonth;
}
[class*="cal-cell"]:hover, .cell-focus, [class*="cal-cell"] .drop-active, .cal-cell.drop-active {
[class*="cal-cell"]:hover,
.cell-focus,
[class*="cal-cell"] .drop-active,
.cal-cell.drop-active,
.cal-week-box .cal-cell1.drop-active {
background-color: @dayHover;
}
.cal-year-box [class*="span"],
@@ -3,13 +3,13 @@
on-drop="vm.handleEventDrop(dropData.event, day.date, dropData.draggedFromDate)"
class="cal-month-day {{ day.cssClass }}"
ng-class="{
'cal-day-outmonth': !day.inMonth,
'cal-day-inmonth': day.inMonth,
'cal-day-weekend': day.isWeekend,
'cal-day-past': day.isPast,
'cal-day-today': day.isToday,
'cal-day-future': day.isFuture
}">
'cal-day-outmonth': !day.inMonth,
'cal-day-inmonth': day.inMonth,
'cal-day-weekend': day.isWeekend,
'cal-day-past': day.isPast,
'cal-day-today': day.isToday,
'cal-day-future': day.isFuture
}">

<small
class="cal-events-num badge badge-important pull-left"
@@ -9,7 +9,9 @@
'cal-day-past': day.isPast,
'cal-day-today': day.isToday,
'cal-day-future': day.isFuture}"
mwl-element-dimensions="vm.dayColumnDimensions">
mwl-element-dimensions="vm.dayColumnDimensions"
mwl-droppable
on-drop="vm.eventDropped(dropData.event, day.date)">

<span ng-bind="day.weekDayLabel"></span>
<br>
@@ -146,4 +146,11 @@ describe('mwlCalendarWeek directive', function() {
});
});

it('should allow events to be dropped on days', function() {
var event = {startsAt: moment().add(1, 'day').toDate()};
MwlCalendarCtrl.weekDragged = sinon.spy();
MwlCalendarCtrl.eventDropped(event, new Date());
expect(MwlCalendarCtrl.weekDragged).to.have.been.calledWith(event, -1);
});

});

0 comments on commit 1ea99a3

Please sign in to comment.
You can’t perform that action at this time.