Finish up admin permissions

This commit is contained in:
Joseph Schorr 2013-09-27 15:48:54 -04:00
parent 4a80100f8f
commit 479e23b09d
4 changed files with 65 additions and 2 deletions

View file

@ -44,6 +44,10 @@ p.editable:hover i {
position: relative;
}
.repo .header .back {
margin-right: 6px;
}
.repo .description {
margin-bottom: 40px;
}
@ -76,6 +80,14 @@ p.editable:hover i {
width: 300px;
}
.repo .settings-cog {
margin-left: 20px;
}
.repo .settings-cog a {
text-decoration: none !important;
}
.repo-listing {
display: block;
margin-bottom: 20px;

View file

@ -58,7 +58,13 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) {
permission.role = role;
var permissionPut = Restangular.one('repository/' + namespace + '/' + name + '/permissions/' + username);
permissionPut.customPUT(permission);
permissionPut.customPUT(permission).then(function() {}, function(result) {
if (result.status == 409) {
$('#onlyAdminModal').modal();
} else {
$('#cannotchangeModal').modal();
}
});
};
var permissionsFetch = Restangular.one('repository/' + namespace + '/' + name + '/permissions');

View file

@ -4,6 +4,7 @@
<div class="container repo repo-admin" ng-show="repo && permissions">
<div class="header">
<a href="{{ '#/repository/' + repo.namespace + '/' + repo.name }}" class="back"><i class="icon-chevron-left"></i></a>
<h3>
<i class="icon-hdd icon-large"></i> <span style="color: #aaa;"> {{repo.namespace}}</span> <span style="color: #ccc">/</span> {{repo.name}}
</h3>
@ -38,4 +39,42 @@
</div>
</div>
<!-- Modal message dialog -->
<div class="modal fade" id="cannotchangeModal">
<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">Cannot change permissions</h4>
</div>
<div class="modal-body">
The selected permissions could not be changed because you do not have that authority.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal message dialog -->
<div class="modal fade" id="onlyadminModal">
<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">Cannot change permissions</h4>
</div>
<div class="modal-body">
The selected permissions could not be changed because the user is the only <b>admin</b> on the repo.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>

View file

@ -7,6 +7,12 @@
<div class="header">
<h3>
<i class="icon-hdd icon-large"></i> <span style="color: #aaa;"> {{repo.namespace}}</span> <span style="color: #ccc">/</span> {{repo.name}}
<span class="settings-cog" ng-show="repo.can_admin" title="Repository Settings">
<a href="{{ '#/repository/' + repo.namespace + '/' + repo.name + '/admin' }}">
<i class="icon-cog icon-large"></i>
</a>
</span>
</h3>
<!-- Pull command -->
@ -22,7 +28,7 @@
<!-- Tab bar -->
<ul class="nav nav-tabs">
<li>
<span class="tag-dropdown dropdown">
<span class="tag-dropdown dropdown" title="Tags">
<i class="icon-bookmark"></i>
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">{{currentTag.name}} <b class="caret"></b></a>
<ul class="dropdown-menu">