summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2018-12-13 14:07:18 +0100
committerGitHub <noreply@github.com>2018-12-13 14:07:18 +0100
commit6e913298724b508ae1fb0653b56f43db067d60a5 (patch)
tree726793b762dfef8081cfb02a79eac35aa0ee86ef /core
parent7034df7d77dda48971b86cf006b843444f667f4d (diff)
parent5723f77ef720daf7ae1d5d697472ddf52c7f9f8c (diff)
downloadnextcloud-server-6e913298724b508ae1fb0653b56f43db067d60a5.tar.gz
nextcloud-server-6e913298724b508ae1fb0653b56f43db067d60a5.zip
Merge pull request #12923 from nextcloud/fix/12832/share-autocomplete
Fixes the share autocomplete layout
Diffstat (limited to 'core')
-rw-r--r--core/css/jquery-ui-fixes.scss9
-rw-r--r--core/js/sharedialogview.js11
2 files changed, 19 insertions, 1 deletions
diff --git a/core/css/jquery-ui-fixes.scss b/core/css/jquery-ui-fixes.scss
index eab22e70d62..31714dc34b3 100644
--- a/core/css/jquery-ui-fixes.scss
+++ b/core/css/jquery-ui-fixes.scss
@@ -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 {
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index e2ef8db90eb..a433570b13d 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -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);