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
Léo-Paul Géneau
gitlab-ce
Commits
2bbc44cb
Commit
2bbc44cb
authored
Dec 12, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor itemClicked
parent
6c811d47
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
18 deletions
+15
-18
app/assets/javascripts/filtered_search/dropdown_non_user.js.es6
...sets/javascripts/filtered_search/dropdown_non_user.js.es6
+3
-8
app/assets/javascripts/filtered_search/dropdown_user.js.es6
app/assets/javascripts/filtered_search/dropdown_user.js.es6
+3
-8
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
...vascripts/filtered_search/filtered_search_dropdown.js.es6
+9
-2
No files found.
app/assets/javascripts/filtered_search/dropdown_non_user.js.es6
View file @
2bbc44cb
...
@@ -20,15 +20,10 @@
...
@@ -20,15 +20,10 @@
}
}
itemClicked(e) {
itemClicked(e) {
const dataValueSet = this.setDataValueIfSelected(e.detail.selected);
super.itemClicked(e, (selected) => {
if (!dataValueSet) {
const title = e.detail.selected.querySelector('.js-data-value').innerText.trim();
const title = e.detail.selected.querySelector('.js-data-value').innerText.trim();
const name = `${this.symbol}${this.getEscapedText(title)}`;
return `${this.symbol}${this.getEscapedText(title)}`;
gl.FilteredSearchDropdownManager.addWordToInput(this.getSelectedText(name));
});
}
this.dismissDropdown(!dataValueSet);
}
}
getEscapedText(text) {
getEscapedText(text) {
...
...
app/assets/javascripts/filtered_search/dropdown_user.js.es6
View file @
2bbc44cb
...
@@ -23,14 +23,9 @@
...
@@ -23,14 +23,9 @@
}
}
itemClicked(e) {
itemClicked(e) {
const dataValueSet = this.setDataValueIfSelected(e.detail.selected);
super.itemClicked(e, (selected) => {
return selected.querySelector('.dropdown-light-content').innerText.trim();
if (!dataValueSet) {
});
const username = e.detail.selected.querySelector('.dropdown-light-content').innerText.trim();
gl.FilteredSearchDropdownManager.addWordToInput(this.getSelectedText(username));
}
this.dismissDropdown(!dataValueSet);
}
}
renderContent(forceShowList = false) {
renderContent(forceShowList = false) {
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
View file @
2bbc44cb
...
@@ -35,8 +35,15 @@
...
@@ -35,8 +35,15 @@
return lastWordIndex === -1 ? selectedToken : selectedToken.slice(lastWord.length);
return lastWordIndex === -1 ? selectedToken : selectedToken.slice(lastWord.length);
}
}
itemClicked(e) {
itemClicked(e, getValueFunction) {
// Overridden by dropdown sub class
const dataValueSet = this.setDataValueIfSelected(e.detail.selected);
if (!dataValueSet) {
const value = getValueFunction(e.detail.selected)
gl.FilteredSearchDropdownManager.addWordToInput(this.getSelectedText(value));
}
this.dismissDropdown();
}
}
renderContent(forceShowList = false) {
renderContent(forceShowList = false) {
...
...
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