BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3e89960d
Commit
3e89960d
authored
Jul 20, 2017
by
Clement Ho
Committed by
Jacob Schatz
Jul 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor filtered search dropdown parameters
parent
01e02988
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
16 deletions
+36
-16
dropdown_hint.js
app/assets/javascripts/filtered_search/dropdown_hint.js
+3
-2
dropdown_non_user.js
app/assets/javascripts/filtered_search/dropdown_non_user.js
+3
-2
dropdown_user.js
app/assets/javascripts/filtered_search/dropdown_user.js
+3
-2
filtered_search_dropdown.js
...s/javascripts/filtered_search/filtered_search_dropdown.js
+1
-1
filtered_search_dropdown_manager.js
...ripts/filtered_search/filtered_search_dropdown_manager.js
+19
-7
dropdown_user_spec.js
spec/javascripts/filtered_search/dropdown_user_spec.js
+7
-2
No files found.
app/assets/javascripts/filtered_search/dropdown_hint.js
View file @
3e89960d
...
...
@@ -2,8 +2,9 @@ import Filter from '~/droplab/plugins/filter';
import
'./filtered_search_dropdown'
;
class
DropdownHint
extends
gl
.
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
tokenKeys
,
filter
)
{
super
(
droplab
,
dropdown
,
input
,
filter
);
constructor
(
options
=
{})
{
const
{
input
,
tokenKeys
}
=
options
;
super
(
options
);
this
.
config
=
{
Filter
:
{
template
:
'hint'
,
...
...
app/assets/javascripts/filtered_search/dropdown_non_user.js
View file @
3e89960d
...
...
@@ -5,8 +5,9 @@ import Filter from '~/droplab/plugins/filter';
import
'./filtered_search_dropdown'
;
class
DropdownNonUser
extends
gl
.
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
tokenKeys
,
filter
,
endpoint
,
symbol
)
{
super
(
droplab
,
dropdown
,
input
,
filter
);
constructor
(
options
=
{})
{
const
{
input
,
endpoint
,
symbol
}
=
options
;
super
(
options
);
this
.
symbol
=
symbol
;
this
.
config
=
{
Ajax
:
{
...
...
app/assets/javascripts/filtered_search/dropdown_user.js
View file @
3e89960d
...
...
@@ -5,8 +5,9 @@ import './filtered_search_dropdown';
import
{
addClassIfElementExists
}
from
'../lib/utils/dom_utils'
;
class
DropdownUser
extends
gl
.
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
tokenKeys
,
filter
)
{
super
(
droplab
,
dropdown
,
input
,
filter
);
constructor
(
options
=
{})
{
const
{
tokenKeys
}
=
options
;
super
(
options
);
this
.
config
=
{
AjaxFilter
:
{
endpoint
:
`
${
gon
.
relative_url_root
||
''
}
/autocomplete/users.json`
,
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown.js
View file @
3e89960d
const
DATA_DROPDOWN_TRIGGER
=
'data-dropdown-trigger'
;
class
FilteredSearchDropdown
{
constructor
(
droplab
,
dropdown
,
input
,
filter
)
{
constructor
(
{
droplab
,
dropdown
,
input
,
filter
}
)
{
this
.
droplab
=
droplab
;
this
.
hookId
=
input
&&
input
.
id
;
this
.
input
=
input
;
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
View file @
3e89960d
...
...
@@ -42,13 +42,19 @@ class FilteredSearchDropdownManager {
milestone
:
{
reference
:
null
,
gl
:
'DropdownNonUser'
,
extraArguments
:
[
`
${
this
.
baseEndpoint
}
/milestones.json`
,
'%'
],
extraArguments
:
{
endpoint
:
`
${
this
.
baseEndpoint
}
/milestones.json`
,
symbol
:
'%'
,
},
element
:
this
.
container
.
querySelector
(
'#js-dropdown-milestone'
),
},
label
:
{
reference
:
null
,
gl
:
'DropdownNonUser'
,
extraArguments
:
[
`
${
this
.
baseEndpoint
}
/labels.json`
,
'~'
],
extraArguments
:
{
endpoint
:
`
${
this
.
baseEndpoint
}
/labels.json`
,
symbol
:
'~'
,
},
element
:
this
.
container
.
querySelector
(
'#js-dropdown-label'
),
},
hint
:
{
...
...
@@ -97,13 +103,19 @@ class FilteredSearchDropdownManager {
let
forceShowList
=
false
;
if
(
!
mappingKey
.
reference
)
{
const
dl
=
this
.
droplab
;
const
defaultArguments
=
[
null
,
dl
,
element
,
this
.
filteredSearchInput
,
this
.
filteredSearchTokenKeys
,
key
];
const
glArguments
=
defaultArguments
.
concat
(
mappingKey
.
extraArguments
||
[]);
const
defaultArguments
=
{
droplab
:
this
.
droplab
,
dropdown
:
element
,
input
:
this
.
filteredSearchInput
,
tokenKeys
:
this
.
filteredSearchTokenKeys
,
filter
:
key
,
};
const
extraArguments
=
mappingKey
.
extraArguments
||
{};
const
glArguments
=
Object
.
assign
({},
defaultArguments
,
extraArguments
);
// Passing glArguments to `new gl[glClass](<arguments>)`
mappingKey
.
reference
=
new
(
Function
.
prototype
.
bind
.
apply
(
gl
[
glClass
],
glArguments
))();
mappingKey
.
reference
=
new
(
Function
.
prototype
.
bind
.
apply
(
gl
[
glClass
],
[
null
,
glArguments
]))();
}
if
(
firstLoad
)
{
...
...
spec/javascripts/filtered_search/dropdown_user_spec.js
View file @
3e89960d
...
...
@@ -12,7 +12,9 @@ describe('Dropdown User', () => {
spyOn
(
gl
.
DropdownUser
.
prototype
,
'getProjectId'
).
and
.
callFake
(()
=>
{});
spyOn
(
gl
.
DropdownUtils
,
'getSearchInput'
).
and
.
callFake
(()
=>
{});
dropdownUser
=
new
gl
.
DropdownUser
(
null
,
null
,
null
,
gl
.
FilteredSearchTokenKeys
);
dropdownUser
=
new
gl
.
DropdownUser
({
tokenKeys
:
gl
.
FilteredSearchTokenKeys
,
});
});
it
(
'should not return the double quote found in value'
,
()
=>
{
...
...
@@ -78,7 +80,10 @@ describe('Dropdown User', () => {
loadFixtures
(
fixtureTemplate
);
authorFilterDropdownElement
=
document
.
querySelector
(
'#js-dropdown-author'
);
const
dummyInput
=
document
.
createElement
(
'div'
);
dropdown
=
new
gl
.
DropdownUser
(
null
,
authorFilterDropdownElement
,
dummyInput
);
dropdown
=
new
gl
.
DropdownUser
({
dropdown
:
authorFilterDropdownElement
,
input
:
dummyInput
,
});
});
const
findCurrentUserElement
=
()
=>
authorFilterDropdownElement
.
querySelector
(
'.js-current-user'
);
...
...
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