-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-app.js
More file actions
128 lines (110 loc) · 3.48 KB
/
test-app.js
File metadata and controls
128 lines (110 loc) · 3.48 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
var app = angular.module("test-app", ['ngDialog']);
app.directive('sprintBacklog', function() {
return {
restrict: 'E',
templateUrl: 'directives/sprintBacklog.html'
}
});
app.controller("sprintBacklogController", ['$scope','ngDialog',function($scope, ngDialog) {
$scope.sprintItems = [
{
description: "Story 1",
done: true,
link: "story1",
tasks: [
{
status: "doing",
description: "Gör det här",
link: "task 1.1"
},
{
status: "doing",
description: "Inte det här",
link: "task 1.2"
}
]
},
{
description: "Story 2",
done: false,
link: "story2",
tasks: [
{
status: "todo",
description: "gul",
link: "task 2.1"
},
{
status: "done",
description: "blå",
link: "task 2.2"
}
]
},
{
description: "Story 3",
done: false,
link: "story3",
tasks: [
{
status: "doing",
description: "röd",
link: "task 3.1"
},
{
status: "todo",
description: "svart",
link: "task 3.2"
},
{
status: "todo",
description: "grön",
link: "task 3.3"
},
{
status: "todo",
description: "rosa",
link: "task 3.4"
}
]
}
];
$scope.toggleSprintItemModal = function (index, itemType) {
// Creates a new scope for the modal
var modalScope = $scope.$new();
var description, items;
switch (itemType.type) {
case "story":
description = $scope.sprintItems[index].description;
items = $scope.sprintItems[index].tasks;
modalScope.content = {description: description,items: items};
break;
case "task":
description = $scope.sprintItems[index].description + ":" + itemType.status;
items = $scope.sprintItems[index].tasks;
var modalItems = [];
// Sorting out the tasks with the right status
for (var i = 0, len = items.length; i < len; i++)
if (items[i].status === itemType.status)
modalItems.push(items[i]);
modalScope.content = { description: description, items: modalItems };
break;
}
ngDialog.open({
template: 'sprintBacklogDialog.html',
className: 'ngdialog-theme-plain',
scope: modalScope
});
};
$scope.storyLimit = 10;
$scope.countTasks = function(index,status) {
var tasks = $scope.sprintItems[index].tasks;
var counter = 0;
angular.forEach(tasks, function(value, i) {
if (value.status === status) {
counter++;
}
});
return counter;
};
}]);