This repository was archived by the owner on Nov 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprojectDetail.controller.js
More file actions
executable file
·135 lines (102 loc) · 3.85 KB
/
projectDetail.controller.js
File metadata and controls
executable file
·135 lines (102 loc) · 3.85 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
'use strict';
(function () {
angular.module('dashboardProjectApp')
.controller('projectDetailController', ['$scope','$state', 'UserStory', '$location', 'DateService',
function($scope, $state, UserStory, $location, DateService) {
$scope.taskId = $state.params.id;
$scope.openTasks = {};
$scope.showText = {};
$scope.warnings = {};
$scope.closeTask = function(task){
$scope.openTasks[task] = !$scope.openTasks[task];
}
$scope.getProjectIcon = function(key){
if(key == 'nova')
return 'fa fa-cogs';
if(key == 'cinder')
return 'fa fa-archive'
if(key == 'keystone')
return 'fa fa-key';
if(key == 'swift')
return 'fa fa-object-group';
if(key == 'neutron')
return 'fa fa-cloud-upload';
if(key == 'glance')
return 'fa fa-key';
return 'fa fa-cog';
}
$scope.actualProject = {};
function setWarning(key, message){
if(message){
$scope.warnings[key] = {
message:message
}
}else{
$scope.warnings[key] = message
}
}
function getFile() {
UserStory.findById({id:$scope.taskId},
function success(userStory) {
$scope.userStory = userStory;
// Formating User Story name
if ((userStory.description).length > 100) {
$scope.userStory.shortDescription = userStory.
description.substr(0,50) + " ...";
}
else {
$scope.userStory.shortDescription = userStory.
description;
}
$scope.userStory.createdOn = DateService.validateDate(
$scope.userStory.createdOn,
'createdOn', setWarning);
if($scope.userStory.updatedOn !=='') {
$scope.userStory.updatedOn = moment($scope.userStory.updatedOn,
"YYYY-MM-DD").format("MM-DD-YYYY");
} else {
$scope.userStory.updatedOn = $scope.userStory.createdOn;
}
if(!$scope.warnings['createdOn']
&& !$scope.warnings['updatedOn']){
DateService.compareDates($scope.userStory.createdOn,
$scope.userStory.updatedOn, 'createdOn', setWarning);
}
for(var key in $scope.userStory.tasks_status) {
$scope.actualProject[key] = $scope.userStory.
tasks_status[key].projects[0]
}
}, function onError(error){
$location.path('/projectDetail/notFound/' + $scope.taskId);
}
);
};
$scope.selectProject = function(keyProject, idTask){
$scope.actualProject[idTask] = keyProject
}
$scope.showMore = function(key){
$scope.showText[key] = true;
}
$scope.showLess = function(key){
$scope.showText[key] = false;
}
$scope.mailTo = function(user, email){
window.location.href = "mailto:" + email + "?subject=Mail to " + email;
}
getFile();
}])
.filter('capitalize', function() {
return function(input) {
return (!!input) ? input.charAt(0).toUpperCase() + input.substr(1).
toLowerCase() : '';
}
})
.filter('removeDashes', function() {
return function(string) {
if (!angular.isString(string)) {
return string;
}
return string.replace(/-/g, ' ');
};
})
})();