Work in progress: Start on org view and finish up the team members view
This commit is contained in:
parent
e6fadbca05
commit
61e9b1629d
4 changed files with 51 additions and 7 deletions
|
@ -298,8 +298,8 @@ def get_organization_team_members(orgname, teamname):
|
||||||
if current_user.is_anonymous():
|
if current_user.is_anonymous():
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
# TODO: determine whether the user has permission to view the team members of this team
|
# TODO: determine whether the user has permission to view the members of this team
|
||||||
# (i.e. they are a member of the team [maybe??] OR they are an admin of the org)
|
# (i.e. they are a member of the team OR they are an admin of the org)
|
||||||
user = current_user.db_user()
|
user = current_user.db_user()
|
||||||
team = None
|
team = None
|
||||||
|
|
||||||
|
@ -309,8 +309,11 @@ def get_organization_team_members(orgname, teamname):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
members = model.get_organization_team_members(team.id)
|
members = model.get_organization_team_members(team.id)
|
||||||
|
|
||||||
|
# TODO: determine whether the user has permission to *edit* the members of this team.
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'members': { m.username : member_view(m) for m in members }
|
'members': { m.username : member_view(m) for m in members },
|
||||||
|
'can_edit': True
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1179,6 +1179,18 @@ function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangula
|
||||||
|
|
||||||
function OrgViewCtrl($scope, Restangular, $routeParams) {
|
function OrgViewCtrl($scope, Restangular, $routeParams) {
|
||||||
var orgname = $routeParams.orgname;
|
var orgname = $routeParams.orgname;
|
||||||
|
|
||||||
|
var loadOrganization = function() {
|
||||||
|
var getOrganization = Restangular.one(getRestUrl('organization', orgname));
|
||||||
|
getOrganization.get().then(function(resp) {
|
||||||
|
$scope.organization = resp;
|
||||||
|
$scope.loading = false;
|
||||||
|
}, function() {
|
||||||
|
$scope.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
loadOrganization();
|
||||||
}
|
}
|
||||||
|
|
||||||
function OrgAdminCtrl($scope, Restangular, $routeParams) {
|
function OrgAdminCtrl($scope, Restangular, $routeParams) {
|
||||||
|
@ -1238,6 +1250,7 @@ function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) {
|
||||||
var getMembers = Restangular.one(getRestUrl('organization', orgname, 'team', teamname, 'members'));
|
var getMembers = Restangular.one(getRestUrl('organization', orgname, 'team', teamname, 'members'));
|
||||||
getMembers.get().then(function(resp) {
|
getMembers.get().then(function(resp) {
|
||||||
$scope.members = resp.members;
|
$scope.members = resp.members;
|
||||||
|
$scope.canEditMembers = resp.can_edit;
|
||||||
$scope.loading = !$scope.organization || !$scope.members;
|
$scope.loading = !$scope.organization || !$scope.members;
|
||||||
$rootScope.title = teamname + ' (' + orgname + ')';
|
$rootScope.title = teamname + ' (' + orgname + ')';
|
||||||
}, function() {
|
}, function() {
|
||||||
|
|
11
static/partials/org-view.html
Normal file
11
static/partials/org-view.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="loading" ng-show="loading">
|
||||||
|
<i class="fa fa-spinner fa-spin fa-3x"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="loading" ng-show="!loading && !organization">
|
||||||
|
No matching organization found
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-view container" ng-show="!loading && organization">
|
||||||
|
<div class="organization-header" organization="organization"></div>
|
||||||
|
</div>
|
|
@ -21,14 +21,14 @@
|
||||||
<span>{{ member.username }}</span>
|
<span>{{ member.username }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="delete-ui" tabindex="0" title="Remove User">
|
<span class="delete-ui" tabindex="0" title="Remove User" ng-show="canEditMembers">
|
||||||
<span class="delete-ui-button" ng-click="removeMember(member.username)"><button class="btn btn-danger">Remove</button></span>
|
<span class="delete-ui-button" ng-click="removeMember(member.username)"><button class="btn btn-danger">Remove</button></span>
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr ng-show="canEditMembers">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span class="entity-search" organization="''" input-title="'Add a user...'" entity-selected="addNewMember"></span>
|
<span class="entity-search" organization="''" input-title="'Add a user...'" entity-selected="addNewMember"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -36,6 +36,23 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal message dialog -->
|
||||||
|
<div class="modal fade" id="cannotChangeMembersModal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title">Cannot change members</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
You do not have permission to change the members of this team.
|
||||||
|
</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 -->
|
||||||
|
|
Reference in a new issue