Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})
Expand Down
29 changes: 29 additions & 0 deletions app/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down Expand Up @@ -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',
Expand Down
21 changes: 21 additions & 0 deletions app/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
])
Expand Down
24 changes: 24 additions & 0 deletions app/views/delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<header>
<div class="container">
<h1 class="feature-title">Delete sprints</h1>
</div>
</header>

<div class="container">
<table class="table">
<thead>
<th>Title</th>
<th>Date Completed</th>
<th>Delete Action</th>
</thead>
<tbody>
<tr ng-repeat="sprint in sprints | orderBy:'-dueDate'">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<td><a href="/sprint/{{sprint.id}}">{{ sprint.title }}</a></td>
<td>{{ sprint.dueDate | date: 'MMM d, y' }}</td>
<td><button class="btn btn-danger" ng-click="delete(sprint.id)" name="sprintdel" value="{{sprint.id}}" ><span class="fa fa-trash"></span>Delete</button></td>
</tr>
</tbody>

</table>
</ul>
</div>
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