Semaphore/public/js/controllers/dashboard.js
Matej Kramny ea0245b550 Events
- Complete more UI work
- Show events on dashboard & project dashboard
- Show list of tasks
2016-04-16 20:42:57 +01:00

25 lines
697 B
JavaScript

define(['controllers/projects/edit'], function () {
app.registerController('DashboardCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $modal) {
$scope.projects = [];
$http.get('/projects').success(function (projects) {
$scope.projects = projects;
});
$http.get('/events').success(function (events) {
$scope.events = events;
});
$scope.addProject = function () {
$modal.open({
templateUrl: '/tpl/projects/add.html'
}).result.then(function (project) {
$http.post('/projects', project)
.success(function () {
}).error(function (data, status) {
swal('Error', 'Could not create project: ' + status, 'error');
});
});
}
}]);
});