[Timelines] Change namespacing for directives

WTD-1239
This commit is contained in:
Victor Woeltjen
2015-10-23 13:48:07 -07:00
parent 8159c365b5
commit 19ad4c8174
3 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,47 @@
/*global define*/
define(
['./SwimlaneDragConstants'],
function (SwimlaneDragConstants) {
"use strict";
/**
* Defines the `mct-swimlane-drag` directive. When a drag is initiated
* form an element with this attribute, the swimlane being dragged
* (identified by the value of this attribute, as an Angular expression)
* will be exported to the `dndService` as part of the active drag-drop
* state.
* @param {DndService} dndService drag-and-drop service
*/
function MCTSwimlaneDrag(dndService) {
function link(scope, element, attrs) {
// Look up the swimlane from the provided expression
function swimlane() {
return scope.$eval(attrs.mctSwimlaneDrag);
}
// When drag starts, publish via dndService
element.on('dragstart', function () {
dndService.setData(
SwimlaneDragConstants.TIMELINE_SWIMLANE_DRAG_TYPE,
swimlane()
);
});
// When drag ends, clear via dndService
element.on('dragend', function () {
dndService.removeData(
SwimlaneDragConstants.TIMELINE_SWIMLANE_DRAG_TYPE
);
});
}
return {
// Applies to attributes
restrict: "A",
// Link using above function
link: link
};
}
return MCTSwimlaneDrag;
}
);