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

feat(drag-and-drop): expose the date the calendar event was dragged f…

…rom on the month view

Closes #250
  • Loading branch information...
Matt Lewis
Matt Lewis committed Jan 1, 2016
1 parent b0887a1 commit 5ca6920a9d92b85849b5626a48043bb237bb2226
@@ -143,7 +143,7 @@ This expression is called when an event is clicked on the calendar. `calendarEve

### on-event-times-changed

This expression is called when an event is dragged and dropped or resized into a different date / time on the calendar. The available values that are passed to the expression are: `calendarEvent`, `calendarNewEventStart` and `calendarNewEventEnd`. The directive won't change the event object and leaves that up to you to implement. Please note drag and drop is only available by including the [interact.js](http://interactjs.io/) library.
This expression is called when an event is dragged and dropped or resized into a different date / time on the calendar. The available values that are passed to the expression are: `calendarEvent`, `calendarNewEventStart`, `calendarNewEventEnd` and `calendarDraggedFromDate` (month view only). The directive won't change the event object and leaves that up to you to implement. Please note drag and drop is only available by including the [interact.js](http://interactjs.io/) library.

### edit-event-html

@@ -72,7 +72,7 @@ angular

};

vm.handleEventDrop = function(event, newDayDate) {
vm.handleEventDrop = function(event, newDayDate, draggedFromDate) {

var newStart = moment(event.startsAt)
.date(moment(newDayDate).date())
@@ -84,7 +84,8 @@ angular
calendarEvent: event,
calendarDate: newDayDate,
calendarNewEventStart: newStart.toDate(),
calendarNewEventEnd: newEnd ? newEnd.toDate() : null
calendarNewEventEnd: newEnd ? newEnd.toDate() : null,
calendarDraggedFromDate: draggedFromDate
});
};

@@ -1,6 +1,6 @@
<div
mwl-droppable
on-drop="vm.handleEventDrop(dropData.event, day.date)"
on-drop="vm.handleEventDrop(dropData.event, day.date, dropData.draggedFromDate)"
class="cal-month-day {{ day.cssClass }}"
ng-class="{
'cal-day-outmonth': !day.inMonth,
@@ -10,6 +10,6 @@
tooltip-append-to-body="true"
uib-tooltip-html="((event.startsAt | calendarDate:'time':true) + (vm.calendarConfig.displayEventEndTimes && event.endsAt ? ' - ' + (event.endsAt | calendarDate:'time':true) : '') + ' - ' + event.title) | calendarTrustAsHtml"
mwl-draggable="event.draggable === true"
drop-data="{event: event}">
drop-data="{event: event, draggedFromDate: day.date.toDate()}">
</a>
</div>

0 comments on commit 5ca6920

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