Display avatars in entity search autocomplete

Fixes https://github.com/coreos/bugs/issues/1819
This commit is contained in:
Joseph Schorr 2017-02-21 16:29:01 -05:00
parent 2ef55a5842
commit fcff867bfd
4 changed files with 57 additions and 36 deletions

View file

@ -43,7 +43,7 @@ angular.module('quay').directive('entitySearch', function () {
// True if the menu should pull right.
'pullRight': '@pullRight'
},
controller: function($rootScope, $scope, $element, Restangular, UserService, ApiService, UtilService, Config) {
controller: function($rootScope, $scope, $element, Restangular, UserService, ApiService, UtilService, AvatarService, Config) {
$scope.lazyLoading = true;
$scope.teams = null;
@ -286,16 +286,16 @@ angular.module('quay').directive('entitySearch', function () {
},
'suggestion': function (datum) {
template = '<div class="entity-mini-listing">';
if (datum.entity.kind == 'user' && !datum.entity.is_robot) {
template += '<i class="fa fa-user fa-lg"></i>';
if ((datum.entity.kind == 'user' && !datum.entity.is_robot) || (datum.entity.kind == 'org')) {
template += '<i class="fa fa-user fa-lg"><img class="avatar-image" src="' +
AvatarService.getAvatar(datum.entity.avatar.hash, 20, 'blank') +
'"></i>';
} else if (datum.entity.kind == 'external') {
template += '<i class="fa fa-user fa-lg"></i>';
} else if (datum.entity.kind == 'user' && datum.entity.is_robot) {
template += '<i class="fa ci-robot fa-lg"></i>';
} else if (datum.entity.kind == 'team') {
template += '<i class="fa fa-group fa-lg"></i>';
} else if (datum.entity.kind == 'org') {
template += '<i class="fa">' + AvatarService.getAvatar(datum.entity.avatar, 16) + '</i>';
}
template += '<span class="name">' + datum.value + '</span>';