-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.js
126 lines (102 loc) · 3.17 KB
/
2.js
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
var myModule = angular.module('Angello', [])
myModule.controller('MainCtrl', function($scope, angelloModel, angelloHelper) {
$scope.currentStory;
$scope.types = angelloModel.getTypes();
$scope.statuses = angelloModel.getStatuses();
$scope.stories = angelloModel.getStories();
$scope.typesIndex = angelloHelper.buildIndex($scope.types, 'name');
$scope.statusesIndex = angelloHelper.buildIndex($scope.statuses, 'name');
$scope.createStory = function() {
$scope.stories.push({
title: 'New Story',
description: 'Description pending.'
});
}
$scope.setCurrentStory = function(story) {
$scope.currentStory = story;
$scope.currentStatus = $scope.statusesIndex[story.status];
$scope.currentType = $scope.typesIndex[story.type];
};
$scope.setCurrentStatus = function(status) {
if(!!$scope.currentStory) {
$scope.currentStory.status = status.name;
}
};
$scope.setCurrentType = function(type) {
if(!!$scope.currentStory) {
$scope.currentStory.type = type.name;
}
};
});
myModule.factory('angelloHelper', function() {
var buildIndex = function(source, property) {
var tempArray = [];
for(var i = 0, len = source.length; i < len; ++i) {
tempArray[source[i][property]] = source[i];
}
return tempArray;
};
return {
buildIndex: buildIndex
};
});
myModule.factory('angelloModel', function() {
var getStatuses = function() {
var tempArray = [
{ name : 'Back Log' },
{ name : 'To Do' },
{ name : 'In Progress' },
{ name : 'Code Review' },
{ name : 'QA Review' },
{ name : 'Verified' },
{ name : 'Done' }
];
return tempArray;
};
var getTypes = function() {
var tempArray = [
{ name : 'Feature' },
{ name : 'Enhancement' },
{ name : 'Bug' },
{ name : 'Spike' }
];
return tempArray;
};
var getStories = function() {
var tempArray = [
{
title: 'Story 00',
description: 'Description pending.',
criteria: 'Criteria pending.',
status: 'To Do',
type: 'Feature',
reporter: 'Lukas',
assignee: 'Brian'
},
{
title: 'Story 01',
description: 'Description pending.',
criteria: 'Criteria pending.',
status: 'To Do',
type: 'Feature',
reporter: 'Lukas',
assignee: 'Brian'
},
{
title: 'Story 02',
description: 'Description pending.',
criteria: 'Criteria pending.',
status: 'To Do',
type: 'Feature',
reporter: 'Lukas',
assignee: 'Brian'
}
];
return tempArray;
};
return {
getStatuses: getStatuses,
getTypes: getTypes,
getStories: getStories
};
});