diff --git a/app/js/app.js b/app/js/app.js
index 423cf3b..77c8284 100644
--- a/app/js/app.js
+++ b/app/js/app.js
@@ -48,6 +48,10 @@ angular.module('myApp', [
templateUrl: '/views/sprint.html',
controller: 'SubSprintCtrl'
})
+ .when('/delete', {
+ templateUrl: '/views/delete.html',
+ controller: 'DeleteCtrl'
+ })
.when('/error', {
templateUrl: '/views/404.html',
})
diff --git a/app/js/controllers.js b/app/js/controllers.js
index aeaa362..84cab04 100644
--- a/app/js/controllers.js
+++ b/app/js/controllers.js
@@ -174,6 +174,10 @@ angular.module('myApp.controllers', [])
$scope.complete = {};
$scope.archive = sprintService.archive($routeParams.id, function (data) {
+ $scope.m = data;
+ });
+
+ $scope.delete = sprintService.delete($routeParams.id, function (data) {
$scope.m = data
});
@@ -472,6 +476,31 @@ angular.module('myApp.controllers', [])
});
}
])
+ .controller('DeleteCtrl', [
+ '$scope',
+ 'sprintService',
+
+
+ function ($scope, sprintService) {
+ $scope.m = {};
+ $scope.$on('sprintRefresh', function (event, sprints) {
+ $scope.sprints = sprints;
+ });
+ $scope.pageTitle = 'Delete Sprints'
+ sprintService
+ .getAll()
+ .success(function (sprints) {
+ $scope.sprints = sprints;
+ });
+ $scope.delete=function(sprintid) {
+ sprintService
+ .deleteSprint(sprintid,function (data) {
+
+ });
+
+ }
+ }
+ ])
.controller('ArchivedCtrl', [
'$scope',
'sprintService',
diff --git a/app/js/services.js b/app/js/services.js
index 315b71f..d41f92f 100644
--- a/app/js/services.js
+++ b/app/js/services.js
@@ -28,6 +28,13 @@ angular.module('myApp.services', ['ngResource'])
}
});
};
+ service.getAll = function() {
+ return $http.get('/api/sprints', {
+ params: {
+ limit: 100
+ }
+ })
+ }
service.newBugUrl = function (whiteboard, defaultComponent) {
var link = 'https://bugzilla.redhat.com/enter_bug.cgi?status_whiteboard=' + encodeURIComponent(whiteboard);
@@ -54,6 +61,20 @@ angular.module('myApp.services', ['ngResource'])
.success(cb);
};
};
+ service.deleteSprint = function(id,cb) {
+ $http
+ .put('/api/sprint/' + id, {
+ deletion: true
+ })
+ .success(function (data){
+ $http
+ .get('/api/sprints')
+ .success(function(data) {
+ service.sprints = data;
+ $rootScope.$broadcast('sprintRefresh', service.sprints);
+ });
+ });
+ };
return service;
}
])
diff --git a/app/views/delete.html b/app/views/delete.html
new file mode 100644
index 0000000..7eb5300
--- /dev/null
+++ b/app/views/delete.html
@@ -0,0 +1,24 @@
+Delete sprints
+
| Title | +Date Completed | +Delete Action | + + +
|---|---|---|
| {{ sprint.title }} | +{{ sprint.dueDate | date: 'MMM d, y' }} | ++ |