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
Jérome Perrin
gitlab-ce
Commits
ad02257c
Commit
ad02257c
authored
Nov 08, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where clear search button would not toggle visible
parent
d797b03b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+13
-7
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
ad02257c
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
const clearSearch = document.querySelector('.clear-search');
const clearSearch = document.querySelector('.clear-search');
input.addEventListener('input', this.tokenize.bind(this));
input.addEventListener('input', this.tokenize.bind(this));
input.addEventListener('input', this.toggleClearSearchButton);
input.addEventListener('keydown', this.checkForEnter.bind(this));
input.addEventListener('keydown', this.checkForEnter.bind(this));
clearSearch.addEventListener('click', this.clearSearch.bind(this));
clearSearch.addEventListener('click', this.clearSearch.bind(this));
...
@@ -42,10 +43,8 @@
...
@@ -42,10 +43,8 @@
event.preventDefault();
event.preventDefault();
this.clearTokens();
this.clearTokens();
const input = document.querySelector('.filtered-search');
document.querySelector('.filtered-search').value = '';
input.value = '';
document.querySelector('.clear-search').classList.add('hidden');
event.target.classList.add('hidden');
}
}
clearTokens() {
clearTokens() {
...
@@ -101,13 +100,20 @@
...
@@ -101,13 +100,20 @@
}
}
}
}
toggleClearSearchButton(event) {
const clearSearch = document.querySelector('.clear-search');
if (event.target.value) {
clearSearch.classList.remove('hidden');
} else {
clearSearch.classList.add('hidden');
}
}
tokenize(event) {
tokenize(event) {
// Re-calculate tokens
// Re-calculate tokens
this.clearTokens();
this.clearTokens();
// Enable clear button
document.querySelector('.clear-search').classList.remove('hidden');
const input = event.target.value;
const input = event.target.value;
const inputs = input.split(' ');
const inputs = input.split(' ');
let searchTerms = '';
let searchTerms = '';
...
...
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