Skip to content

Commit

Permalink
Fixes BugzIO#18 Delete functionality for sprints, sprints can be dele…
Browse files Browse the repository at this point in the history
…ted before / after archiving
  • Loading branch information
sudheesh001 committed Mar 31, 2015
1 parent 6d91a05 commit a51cb39
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ angular.module('myApp.controllers', [])
$scope.m = data
});

$scope.delete = sprintService.delete($routeParams.id, function (data) {
$scope.m = data
});

$scope.getBugs = function() {
$scope.bugs = [];
bzService.getBugs($scope.m.whiteboard, function (data) {
Expand Down
9 changes: 9 additions & 0 deletions app/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ angular.module('myApp.services', ['ngResource'])
.success(cb);
};
};
service.delete = function(id, cb) {
return function() {
$http
.put('/api/sprint/' +id, {
deletion: true
})
.success(cb);
};
};
return service;
}
])
Expand Down
1 change: 1 addition & 0 deletions app/views/sprint.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h3 class="feature-due-date">
<a ng-if="!m.archived" class="btn btn-danger" href="#" ng-click="archive()">
<span class="fa fa-check"></span> Archive this Sprint
</a>
<a href="#" class="btn btn-danger" ng-click="delete()"><span class="fa fa-trash"></span> Delete Sprint</a>

<form class="form-inline">
<div class="checkbox">
Expand Down
4 changes: 4 additions & 0 deletions server/db/sprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ module.exports = function(sequelize, t) {
archived: {
type: t.BOOLEAN,
default: 0
},
deletion: {
type: t.BOOLEAN,
default: 0
}
});
};
2 changes: 2 additions & 0 deletions server/routes/dbController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = function(db) {
var archivedStatus = req.query.archived || null;
var limit = req.query.limit || 30;
var order = req.query.order || 'dueDate';
var deleted = null ;

if(archivedStatus !== null) {
db.sprint
Expand All @@ -24,6 +25,7 @@ module.exports = function(db) {
db.sprint
.findAll({
limit: limit,
where: {deletion: deleted},
order: order
})
.success(function(data) {
Expand Down

0 comments on commit a51cb39

Please sign in to comment.