Fixed conflicts

This commit is contained in:
Luke Bennett 2016-08-11 15:10:23 +01:00
parent 3e1e9b670f
commit 2f8fada6c0
No known key found for this signature in database
GPG key ID: A738E9C68D3BF31A
3 changed files with 15 additions and 18 deletions

View file

@ -111,9 +111,9 @@
matches = fuzzaldrinPlus.match($el.text().trim(), search_text); matches = fuzzaldrinPlus.match($el.text().trim(), search_text);
if (!$el.is('.dropdown-header')) { if (!$el.is('.dropdown-header')) {
if (matches.length) { if (matches.length) {
return $el.show(); return $el.show().removeClass('option-hidden');
} else { } else {
return $el.hide(); return $el.hide().addClass('option-hidden');
} }
} }
}); });
@ -191,9 +191,9 @@
currentIndex = -1; currentIndex = -1;
NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link'; NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link, .option-hidden';
SELECTABLE_CLASSES = ".dropdown-content li:not(" + NON_SELECTABLE_CLASSES + ")"; SELECTABLE_CLASSES = ".dropdown-content li:not(" + NON_SELECTABLE_CLASSES + ")";
CURSOR_SELECT_SCROLL_PADDING = 5 CURSOR_SELECT_SCROLL_PADDING = 5
@ -247,7 +247,7 @@
keys: searchFields, keys: searchFields,
elements: (function(_this) { elements: (function(_this) {
return function() { return function() {
selector = SELECTABLE_CLASSES; selector = '.dropdown-content li:not(' + NON_SELECTABLE_CLASSES + ')';
if (_this.dropdown.find('.dropdown-toggle-page').length) { if (_this.dropdown.find('.dropdown-toggle-page').length) {
selector = ".dropdown-page-one " + selector; selector = ".dropdown-page-one " + selector;
} }
@ -263,7 +263,7 @@
return function(data) { return function(data) {
_this.parseData(data); _this.parseData(data);
if (_this.filterInput.val() !== '') { if (_this.filterInput.val() !== '') {
selector = '.dropdown-content li:not(.divider):visible'; selector = SELECTABLE_CLASSES;
if (_this.dropdown.find('.dropdown-toggle-page').length) { if (_this.dropdown.find('.dropdown-toggle-page').length) {
selector = ".dropdown-page-one " + selector; selector = ".dropdown-page-one " + selector;
} }
@ -502,7 +502,7 @@
text = this.highlightTextMatches(text, this.filterInput.val()); text = this.highlightTextMatches(text, this.filterInput.val());
} }
if (group) { if (group) {
groupAttrs = "data-group='" + group + "' data-index='" + index + "'"; groupAttrs = 'data-group=' + group + ' data-index=' + index;
} else { } else {
groupAttrs = ''; groupAttrs = '';
} }
@ -617,11 +617,8 @@
} }
$el = $(selector, this.dropdown); $el = $(selector, this.dropdown);
if ($el.length) { if ($el.length) {
return $el.first().trigger('click');
e.preventDefault();
e.stopImmediatePropagation();
$el.first().trigger('click'); $el.first().trigger('click');
href = $el.attr('href'); var href = $el.attr('href');
if (href && href !== '#') Turbolinks.visit(href); if (href && href !== '#') Turbolinks.visit(href);
} }
}; };
@ -671,8 +668,8 @@
}; };
GitLabDropdown.prototype.resetRows = function resetRows() { GitLabDropdown.prototype.resetRows = function resetRows() {
currentIndex = -1; currentIndex = -1;
$('.is-focused', this.dropdown).removeClass('is-focused'); $('.is-focused', this.dropdown).removeClass('is-focused');
}; };
GitLabDropdown.prototype.highlightRowAtIndex = function($listItems, index) { GitLabDropdown.prototype.highlightRowAtIndex = function($listItems, index) {
@ -691,8 +688,8 @@
if (!index) { if (!index) {
$dropdownContent.scrollTop(0) $dropdownContent.scrollTop(0)
} else if (index === ($listItems.length - 1)) { } else if (index === ($listItems.length - 1)) {
$dropdownContent.scrollTop $dropdownContent.prop('scrollHeight'); $dropdownContent.scrollTop($dropdownContent.prop('scrollHeight'));
} else if (listItemBottom > (dropdownContentBottom + dropdownScrollTop)) } else if (listItemBottom > (dropdownContentBottom + dropdownScrollTop)) {
$dropdownContent.scrollTop(listItemBottom - dropdownContentBottom + CURSOR_SELECT_SCROLL_PADDING); $dropdownContent.scrollTop(listItemBottom - dropdownContentBottom + CURSOR_SELECT_SCROLL_PADDING);
} else if (listItemTop < (dropdownContentTop + dropdownScrollTop)) { } else if (listItemTop < (dropdownContentTop + dropdownScrollTop)) {
return $dropdownContent.scrollTop(listItemTop - dropdownContentTop - CURSOR_SELECT_SCROLL_PADDING); return $dropdownContent.scrollTop(listItemTop - dropdownContentTop - CURSOR_SELECT_SCROLL_PADDING);

View file

@ -9,7 +9,7 @@
BACKSPACE: 8, BACKSPACE: 8,
ENTER: 13, ENTER: 13,
UP: 38, UP: 38,
DOWN: 40 DOWN: 40
}; };
function SearchAutocomplete(opts) { function SearchAutocomplete(opts) {

View file

@ -45,10 +45,10 @@
selectable: true, selectable: true,
data: this.projectsData, data: this.projectsData,
text: (project) => { text: (project) => {
(project.name_with_namespace || project.name) (project.name_with_namespace || project.name);
}, },
id: (project) => { id: (project) => {
project.id project.id;
} }
}); });
}); });