-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrollers.js
More file actions
49 lines (42 loc) · 1.4 KB
/
Copy pathcontrollers.js
File metadata and controls
49 lines (42 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// TODO Cancellation function
// TODO Status by selection - Not Started, On Track, Delayed, Completed
// TODO Commenting BLOG, Push new posts to top.
// TODO Date picker for due dates
// TODO Team member indicator tags
// TODO Hyperlink support in comments
// Creates a controller object
var controllers = {};
// Retrives all project data
controllers.projectData = function ($scope, dataFactory) {
$scope.projects = dataFactory.getAllProjects();
};
// Locates project details, creates functionality to manipulate stored data
controllers.projectController = function ($scope, $routeParams, dataFactory) {
$scope.projects = dataFactory.getAllProjects();
// Finds an index within the project Array
var findProject = function () {
for(var i = 0; i < $scope.projects.length; ++i) {
var project = $scope.projects[i];
if(project.title === $routeParams.title) {
return project;
}
}
};
$scope.project = findProject();
};
// Adds new projects
// TODO, error handling / validation
controllers.addController = function ($scope, dataFactory) {
$scope.projects = dataFactory.getAllProjects();
$scope.addProject = function () {
$scope.projects.push(
{
title: $scope.newTitle.title,
author: $scope.newAuthor.author,
status: $scope.newStatus.status,
launch: $scope.newLaunch.launch
});
};
};
// Passes all controllers to the projectManager App
projectManager.controller(controllers);