Work in progress: Continue on org view

This commit is contained in:
Joseph Schorr 2013-11-04 16:51:25 -05:00
parent 17a07ea6e0
commit b56bb92801
4 changed files with 18 additions and 5 deletions

View file

@ -279,8 +279,7 @@ def get_organization_team_members(teamid):
def get_teams_within_org(organization):
joined = Team.select().join(TeamMember)
return joined.where(Team.organization == organization)
return Team.select().where(Team.organization == organization)
def get_user_teams_within_org(username, organization):

View file

@ -244,17 +244,20 @@ def get_organization(orgname):
user = current_user.db_user()
def team_view(t):
view_permission = ViewTeamPermission(orgname, t.name)
return {
'id': t.id,
'name': t.name,
'is_member': False
'can_view': view_permission.can()
}
def org_view(o, teams):
admin_org = AdministerOrganizationPermission(orgname)
return {
'name': o.username,
'gravatar': compute_hash(o.email),
'teams': [team_view(t) for t in teams]
'teams': [team_view(t) for t in teams],
'is_admin': admin_org.can()
}
if current_user.is_anonymous():

View file

@ -1238,6 +1238,8 @@ function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) {
$scope.organization = resp;
$scope.loading = !$scope.organization || !$scope.members;
}, function() {
$scope.organization = null;
$scope.members = null;
$scope.loading = false;
});
};
@ -1250,6 +1252,8 @@ function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) {
$scope.loading = !$scope.organization || !$scope.members;
$rootScope.title = teamname + ' (' + orgname + ')';
}, function() {
$scope.organization = null;
$scope.members = null;
$scope.loading = false;
});
};

View file

@ -11,6 +11,13 @@
<div ng-repeat="team in organization.teams">
<i class="fa fa-group"></i>
<span><a href="/organization/{{ organization.name }}/teams/{{ team.name }}">{{ team.name }}</a></span>
<span ng-show="team.can_view">
<a href="/organization/{{ organization.name }}/teams/{{ team.name }}">{{ team.name }}</a>
</span>
<span ng-show="!team.can_view">
{{ team.name }}
</span>
</div>
</div>