diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-22 11:41:51 -0500 |
---|---|---|
committer | Bryce <bryce@gitlab.com> | 2016-08-23 14:44:29 +0200 |
commit | 86f03e175042afe551cf95c195c043fa92b58ea7 (patch) | |
tree | 443c76032247c3bdc92ff1335b57d503a705f175 /app | |
parent | 5963263912c1633ff49ce758f71589bae8133e57 (diff) | |
download | gitlab-ce-86f03e175042afe551cf95c195c043fa92b58ea7.tar.gz |
Allow passing an index to selectRowAtIndex
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index b1f5a6816e1..0179b320a3b 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -616,9 +616,14 @@ return this.dropdown.before($input); }; - GitLabDropdown.prototype.selectRowAtIndex = function() { + GitLabDropdown.prototype.selectRowAtIndex = function(index) { var $el, selector; - selector = ".dropdown-content .is-focused"; + // If we pass an option index + if (typeof index !== "undefined") { + selector = SELECTABLE_CLASSES + ":eq(" + index + ") a"; + } else { + selector = ".dropdown-content .is-focused"; + } if (this.dropdown.find(".dropdown-toggle-page").length) { selector = ".dropdown-page-one " + selector; } |