Add deletion UI for repos

This commit is contained in:
Joseph Schorr 2013-10-01 14:14:30 -04:00
parent 01240dbf87
commit c75bd732ce
4 changed files with 61 additions and 4 deletions

View file

@ -393,6 +393,7 @@ p.editable:hover i {
.repo-admin .panel {
display: inline-block;
width: 620px;
}
.repo-admin .user i {
@ -478,6 +479,14 @@ p.editable:hover i {
width: 54px;
}
.repo-admin .repo-delete {
text-align: center;
}
.repo-admin .repo-delete button {
font-size: 125%;
}
.repo-admin .repo-access-state .state-icon {
text-align: center;
margin-bottom: 10px;
@ -494,7 +503,7 @@ p.editable:hover i {
.repo-admin .repo-access-state {
text-align: center;
width: 520px;
width: 580px;
}
.repo-admin .repo-access-state .state-icon i.icon-lock {

View file

@ -293,6 +293,23 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) {
});
};
$scope.askDelete = function() {
$('#confirmdeleteModal').modal({});
};
$scope.deleteRepo = function() {
$('#confirmdeleteModal').modal('hide');
var deleteAction = Restangular.one('repository/' + namespace + '/' + name);
deleteAction.customDELETE().then(function() {
setTimeout(function() {
document.location = '/#/repository';
}, 1000);
}, function() {
$('#cannotchangeModal').modal({});
});
};
// Fetch the repository information.
var repositoryFetch = Restangular.one('repository/' + namespace + '/' + name);
repositoryFetch.get().then(function(repo) {

View file

@ -10,7 +10,7 @@
<div class="signup-container">
<form method="post" class="form-signup">
<input type="text" class="form-control" placeholder="Create a username" name="username" autofocus>
<input type="text" class="form-control" placeholder="Email address" name="email" autofocus>
<input type="text" class="form-control" placeholder="Email address" name="email">
<input type="password" class="form-control" placeholder="Create a password" name="password">
<button class="btn btn-lg btn-primary btn-block" type="submit">Get Started!</button>
</form>

View file

@ -79,6 +79,18 @@
</div>
</div>
</div>
<br>
<!-- Delete Repo -->
<div class="panel panel-default">
<div class="panel-heading">Delete Repository</div>
<div class="panel-body">
<div class="repo-delete">
<div class="alert alert-danger">Deleting a repository <b>cannot be undone</b>. Here be dragons!</div>
<button class="btn btn-danger" ng-click="askDelete()">Delete Repository</button>
</div>
</div>
</div>
<!-- Modal message dialog -->
<div class="modal fade" id="cannotchangeModal">
@ -86,10 +98,10 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Cannot change permissions</h4>
<h4 class="modal-title">Cannot change</h4>
</div>
<div class="modal-body">
The selected permissions could not be changed because you do not have that authority.
The selected action could not be performed because you do not have that authority.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
@ -164,4 +176,23 @@
</div><!-- /.modal -->
<!-- Modal message dialog -->
<div class="modal fade" id="confirmdeleteModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Delete Repository?</h4>
</div>
<div class="modal-body">
Are you <b>absolutely, positively</b> sure you would like to delete this repository? This <b>cannot be undone</b>.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" ng-click="deleteRepo()">Delete Repository</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>