Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
2f8fada6
Commit
2f8fada6
authored
Aug 11, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed conflicts
parent
3e1e9b67
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
18 deletions
+15
-18
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+12
-15
app/assets/javascripts/search_autocomplete.js
app/assets/javascripts/search_autocomplete.js
+1
-1
spec/javascripts/gl_dropdown_spec.js.es6
spec/javascripts/gl_dropdown_spec.js.es6
+2
-2
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
2f8fada6
...
...
@@ -111,9 +111,9 @@
matches
=
fuzzaldrinPlus
.
match
(
$el
.
text
().
trim
(),
search_text
);
if
(
!
$el
.
is
(
'
.dropdown-header
'
))
{
if
(
matches
.
length
)
{
return
$el
.
show
();
return
$el
.
show
()
.
removeClass
(
'
option-hidden
'
)
;
}
else
{
return
$el
.
hide
();
return
$el
.
hide
()
.
addClass
(
'
option-hidden
'
)
;
}
}
});
...
...
@@ -191,9 +191,9 @@
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
...
...
@@ -247,7 +247,7 @@
keys
:
searchFields
,
elements
:
(
function
(
_this
)
{
return
function
()
{
selector
=
SELECTABLE_CLASSES
;
selector
=
'
.dropdown-content li:not(
'
+
NON_SELECTABLE_CLASSES
+
'
)
'
;
if
(
_this
.
dropdown
.
find
(
'
.dropdown-toggle-page
'
).
length
)
{
selector
=
"
.dropdown-page-one
"
+
selector
;
}
...
...
@@ -263,7 +263,7 @@
return
function
(
data
)
{
_this
.
parseData
(
data
);
if
(
_this
.
filterInput
.
val
()
!==
''
)
{
selector
=
'
.dropdown-content li:not(.divider):visible
'
;
selector
=
SELECTABLE_CLASSES
;
if
(
_this
.
dropdown
.
find
(
'
.dropdown-toggle-page
'
).
length
)
{
selector
=
"
.dropdown-page-one
"
+
selector
;
}
...
...
@@ -502,7 +502,7 @@
text
=
this
.
highlightTextMatches
(
text
,
this
.
filterInput
.
val
());
}
if
(
group
)
{
groupAttrs
=
"
data-group='
"
+
group
+
"
' data-index='
"
+
index
+
"
'
"
;
groupAttrs
=
'
data-group=
'
+
group
+
'
data-index=
'
+
index
;
}
else
{
groupAttrs
=
''
;
}
...
...
@@ -617,11 +617,8 @@
}
$el
=
$
(
selector
,
this
.
dropdown
);
if
(
$el
.
length
)
{
return
$el
.
first
().
trigger
(
'
click
'
);
e
.
preventDefault
();
e
.
stopImmediatePropagation
();
$el
.
first
().
trigger
(
'
click
'
);
href
=
$el
.
attr
(
'
href
'
);
var
href
=
$el
.
attr
(
'
href
'
);
if
(
href
&&
href
!==
'
#
'
)
Turbolinks
.
visit
(
href
);
}
};
...
...
@@ -671,8 +668,8 @@
};
GitLabDropdown
.
prototype
.
resetRows
=
function
resetRows
()
{
currentIndex
=
-
1
;
$
(
'
.is-focused
'
,
this
.
dropdown
).
removeClass
(
'
is-focused
'
);
currentIndex
=
-
1
;
$
(
'
.is-focused
'
,
this
.
dropdown
).
removeClass
(
'
is-focused
'
);
};
GitLabDropdown
.
prototype
.
highlightRowAtIndex
=
function
(
$listItems
,
index
)
{
...
...
@@ -691,8 +688,8 @@
if
(
!
index
)
{
$dropdownContent
.
scrollTop
(
0
)
}
else
if
(
index
===
(
$listItems
.
length
-
1
))
{
$dropdownContent
.
scrollTop
$dropdownContent
.
prop
(
'
scrollHeight
'
);
}
else
if
(
listItemBottom
>
(
dropdownContentBottom
+
dropdownScrollTop
))
$dropdownContent
.
scrollTop
(
$dropdownContent
.
prop
(
'
scrollHeight
'
)
);
}
else
if
(
listItemBottom
>
(
dropdownContentBottom
+
dropdownScrollTop
))
{
$dropdownContent
.
scrollTop
(
listItemBottom
-
dropdownContentBottom
+
CURSOR_SELECT_SCROLL_PADDING
);
}
else
if
(
listItemTop
<
(
dropdownContentTop
+
dropdownScrollTop
))
{
return
$dropdownContent
.
scrollTop
(
listItemTop
-
dropdownContentTop
-
CURSOR_SELECT_SCROLL_PADDING
);
...
...
app/assets/javascripts/search_autocomplete.js
View file @
2f8fada6
...
...
@@ -9,7 +9,7 @@
BACKSPACE
:
8
,
ENTER
:
13
,
UP
:
38
,
DOWN
:
40
DOWN
:
40
};
function
SearchAutocomplete
(
opts
)
{
...
...
spec/javascripts/gl_dropdown_spec.js.es6
View file @
2f8fada6
...
...
@@ -45,10 +45,10 @@
selectable: true,
data: this.projectsData,
text: (project) => {
(project.name_with_namespace || project.name)
(project.name_with_namespace || project.name)
;
},
id: (project) => {
project.id
project.id
;
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment