Merge pull request #12923 from nextcloud/fix/12832/share-autocomplete

Fixes the share autocomplete layout
This commit is contained in:
John Molakvoæ 2018-12-13 14:07:18 +01:00 committed by GitHub
commit 6e91329872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -171,8 +171,17 @@
.ui-autocomplete {
&.ui-menu {
padding: 0;
/* scrolling starts from three items,
* so hide overflow and scrollbars for a clean layout */
&.item-count-1,
&.item-count-2 {
overflow-y: hidden;
}
.ui-menu-item a {
color: var(--color-text-lighter);
display: block;
padding: 4px 4px 4px 14px;
&.ui-state-focus, &.ui-state-active {

View File

@ -772,7 +772,16 @@
event.preventDefault();
},
source: this.autocompleteHandler,
select: this._onSelectRecipient
select: this._onSelectRecipient,
open: function() {
var autocomplete = $(this).autocomplete('widget');
var numberOfItems = autocomplete.find('li').size();
autocomplete.removeClass('item-count-1');
autocomplete.removeClass('item-count-2');
if (numberOfItems <= 2) {
autocomplete.addClass('item-count-' + numberOfItems);
}
}
}).data('ui-autocomplete')._renderItem = this.autocompleteRenderItem;
$shareField.on('keydown', null, shareFieldKeydownHandler);