Semaphore/public/js/controllers/projects/dashboard.js

33 lines
918 B
JavaScript
Raw Normal View History

2016-04-17 02:20:23 +02:00
define(['controllers/projects/taskRunner'], function () {
app.registerController('ProjectDashboardCtrl', ['$scope', '$http', 'Project', '$uibModal', '$rootScope', function ($scope, $http, Project, $modal, $rootScope) {
$http.get(Project.getURL() + '/events').success(function (events) {
$scope.events = events;
});
2016-04-17 02:20:23 +02:00
$http.get(Project.getURL() + '/tasks').success(function (tasks) {
$scope.tasks = tasks;
$scope.tasks.forEach(function (t) {
if (!t.start || !t.end) {
return;
}
2016-05-16 17:58:18 +02:00
// t.duration = moment(t.start).from(moment(t.end), true);
t.duration = moment(t.start).diff(moment(t.end), 'minutes');
2016-04-17 02:20:23 +02:00
})
});
$scope.openTask = function (task) {
var scope = $rootScope.$new();
scope.task = task;
scope.project = Project;
$modal.open({
templateUrl: '/tpl/projects/taskModal.html',
controller: 'TaskCtrl',
scope: scope,
size: 'lg'
2016-04-17 02:20:23 +02:00
});
}
2016-04-02 14:40:07 +02:00
}]);
});