Skip to content

Commit

Permalink
[9.2] Show avatar in share drop down (#25976)
Browse files Browse the repository at this point in the history
* Show avatar in share drop down

* Fix share autocomplete vertical align with avatar
  • Loading branch information
DeepDiver1975 authored Oct 6, 2016
1 parent 9baf2a8 commit 9fd9a01
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
13 changes: 13 additions & 0 deletions core/css/share.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@
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 {
list-style-type:none;
padding:8px;
Expand Down
23 changes: 14 additions & 9 deletions core/js/sharedialogview.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
},

autocompleteRenderItem: function(ul, item) {
var insert = $("<a>");

var text = item.label;
if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
text = t('core', '{sharee} (group)', {
Expand All @@ -267,15 +267,20 @@
});
}
}
insert.text(text);
insert.attr('title', item.value.shareWith);
if(item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
insert = insert.wrapInner('<strong></strong>');
var insert = $("<div class='share-autocomplete-item'/>");
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
if (item.value.shareType === OC.Share.SHARE_TYPE_USER) {
avatar.avatar(item.value.shareWith, 32, undefined, undefined, undefined, item.label);
} else {
avatar.imageplaceholder(text, undefined, 32);
}
insert.tooltip({
placement: 'bottom',
container: 'body'
});

$("<div class='autocomplete-item-text'></div>")
.text(text)
.appendTo(insert);
insert.attr('title', item.value.shareWith);
insert = $("<a>")
.append(insert);
return $("<li>")
.addClass((item.value.shareType === OC.Share.SHARE_TYPE_GROUP) ? 'group' : 'user')
.append(insert)
Expand Down

0 comments on commit 9fd9a01

Please sign in to comment.