Select Git revision
ganttprojectcontroller.js
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ganttprojectcontroller.js 13.63 KiB
// $Id: ganttprojectcontroller.js 32761 2015-11-02 11:50:21Z schaap $
var ganttProjectControllerMod = angular.module('GanttProjectControllerMod', [
'gantt',
'gantt.sortable',
'gantt.movable',
'gantt.drawtask',
'gantt.tooltips',
'gantt.bounds',
'gantt.progress',
'gantt.table',
'gantt.tree',
'gantt.groups',
'gantt.dependencies',
'gantt.overlap',
'gantt.resizeSensor',
'gantt.contextmenu']).config(['$compileProvider', function($compileProvider) {
$compileProvider.debugInfoEnabled(false); // Remove debug info (angularJS >= 1.3)
}]);
ganttProjectControllerMod.controller('GanttProjectController', ['$scope', 'dataService', function($scope, dataService) {
var self = this;
self.doInitialCollapse = true;
$scope.dataService = dataService;
$scope.ganttData = [];
$scope.enabled = true;
self.taskStatusColors = dataService.taskStatusColors;
self.lastUpdateTimestamp = new Date(0);
self.waitingForDelayedUpdate = false;
$scope.options = {
mode: 'custom',
viewScale: '1 hours',
currentDate: 'line',
currentDateValue: $scope.dataService.lofarTime,
columnMagnet: '1 minutes',
timeFramesMagnet: false,
sideMode: 'Table',
autoExpand: 'both',
taskOutOfRange: 'truncate',
dependencies: false,
api: function(api) {
// API Object is used to control methods and events from angular-gantt.
$scope.api = api;
api.core.on.ready($scope, function () {
api.tasks.on.moveEnd($scope, moveHandler);
api.tasks.on.resizeEnd($scope, moveHandler);
}
);
api.directives.on.new($scope, function(directiveName, directiveScope, directiveElement) {
if (directiveName === 'ganttRow' || directiveName === 'ganttRowLabel' ) {
directiveElement.bind('click', function(event) {
if(directiveScope.row.model.project) {
$scope.dataService.selected_project_id = directiveScope.row.model.project.id;
}
});
} else if (directiveName === 'ganttTask') {
directiveElement.bind('click', function(event) {
if(directiveScope.task.model.raTask) {
if(event.ctrlKey) {
$scope.dataService.toggleTaskSelection(directiveScope.task.model.raTask.id);
} else {
$scope.dataService.setSelectedTaskId(directiveScope.task.model.raTask.id);
}
}