Merge pull request #1704 from nextcloud/avatar_dropdown

[us] Show avatar in share drop down
This commit is contained in:
blizzz 2016-10-12 15:38:38 +02:00 committed by GitHub
commit 17fa45a292
2 changed files with 27 additions and 9 deletions

View File

@ -50,6 +50,19 @@
height: 32px; height: 32px;
} }
.share-autocomplete-item {
display: flex;
}
.share-autocomplete-item .autocomplete-item-text {
margin-left: 10px;
margin-right: 10px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
line-height: 32px;
vertical-align: middle;
}
#shareWithList { #shareWithList {
list-style-type:none; list-style-type:none;
padding:8px; padding:8px;

View File

@ -251,7 +251,7 @@
}, },
autocompleteRenderItem: function(ul, item) { autocompleteRenderItem: function(ul, item) {
var insert = $("<a>");
var text = item.label; var text = item.label;
if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) { if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
text = t('core', '{sharee} (group)', { text = t('core', '{sharee} (group)', {
@ -269,15 +269,20 @@
}); });
} }
} }
insert.text(text); var insert = $("<div class='share-autocomplete-item'/>");
insert.attr('title', item.value.shareWith); var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
if(item.value.shareType === OC.Share.SHARE_TYPE_GROUP) { if (item.value.shareType === OC.Share.SHARE_TYPE_USER) {
insert = insert.wrapInner('<strong></strong>'); avatar.avatar(item.value.shareWith, 32, undefined, undefined, undefined, item.label);
} else {
avatar.imageplaceholder(text, undefined, 32);
} }
insert.tooltip({
placement: 'bottom', $("<div class='autocomplete-item-text'></div>")
container: 'body' .text(text)
}); .appendTo(insert);
insert.attr('title', item.value.shareWith);
insert = $("<a>")
.append(insert);
return $("<li>") return $("<li>")
.addClass((item.value.shareType === OC.Share.SHARE_TYPE_GROUP) ? 'group' : 'user') .addClass((item.value.shareType === OC.Share.SHARE_TYPE_GROUP) ? 'group' : 'user')
.append(insert) .append(insert)