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
|
APP.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: '/static/testreporter/templates/index.html',
controller: 'Index'
})
.when('/new', {
templateUrl: '/static/testreporter/templates/tag_form.html',
controller: 'New'
})
.when('/:id', {
templateUrl: '/static/testreporter/templates/report_private.html',
controller: 'Report'
});
}]);
function Index($scope, $window, $routeParams, Tag) {
$scope.tags = Tag.query();
$scope.remove = function(tag) {
Tag.remove({id:tag.id}, function() {
$scope.tags = Tag.query();
});
};
}
function Report($scope, $window, $routeParams, $http, $sce, Tag) {
$scope.tag = Tag.get({id:$routeParams.id}, function() {
$scope.description_markup = $sce.trustAsHtml($scope.tag.description_markup);
})
$scope.testRunUrl = function(testrun_id) {
$window.location.pathname = "/testmanualrunner/#/testrun/" + testrun_id + "/";
}
$http.get('/testreporter/report/'+ $routeParams.id +'/').success(function(data) {
$scope.data = data;
});
$scope.submit = function() {
Tag.update({id:$scope.tag.id}, $scope.tag)
}
}
function New($scope, $window, $routeParams, $location, Tag) {
$scope.tag = {};
$scope.submit = function() {
Tag.save(
$scope.tag,
function() {
$location.path('/');
},
function(error) {
$scope.error = error.data
}
)
}
}
|