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
ceb79e3c
Commit
ceb79e3c
authored
Dec 07, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset filters after clear search
parent
bbad61b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
12 deletions
+55
-12
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
...vascripts/filtered_search/filtered_search_dropdown.js.es6
+37
-1
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+18
-11
No files found.
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
View file @
ceb79e3c
...
...
@@ -71,6 +71,20 @@
this.unbindEvents();
}
show() {
const currentHook = this.getCurrentHook();
if (currentHook) {
currentHook.list.show();
}
}
hide() {
const currentHook = this.getCurrentHook();
if (currentHook) {
currentHook.list.hide();
}
}
dismissDropdown() {
this.input.focus();
// Propogate input change to FilteredSearchManager
...
...
@@ -104,7 +118,7 @@
droplab.setConfig(this.getFilterConfig(this.filterKeyword));
}
render() {
render(
hide
) {
this.setAsDropdown();
const firstTimeInitialized = this.getCurrentHook() === undefined;
...
...
@@ -115,6 +129,28 @@
droplab.changeHookList(this.hookId, `#${this.listId}`);
this.renderContent();
}
if (hide) {
this.hide();
} else {
this.show();
}
}
resetFilters() {
const currentHook = this.getCurrentHook();
if (currentHook) {
const list = currentHook.list;
if (list.data) {
const data = list.data.map((item) => {
item.droplab_hidden = false;
});
list.render(data);
}
}
}
}
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
ceb79e3c
/* eslint-disable no-param-reassign */
((global) => {
function clearSearch(e) {
e.stopPropagation();
e.preventDefault();
document.querySelector('.filtered-search').value = '';
document.querySelector('.clear-search').classList.add('hidden');
}
function toggleClearSearchButton(e) {
const clearSearchButton = document.querySelector('.clear-search');
...
...
@@ -170,7 +162,13 @@
dropdownHint = new gl.DropdownHint(document.querySelector('#js-dropdown-hint'), filteredSearch, this.currentDropdown);
}
dropdownHint.setOffset(dropdownOffset);
dropdownHint.render();
dropdownHint.render(hideDropdown);
}
}
dismissCurrentDropdown() {
if (this.currentDropdown === 'hint') {
dropdownHint.destroy();
}
}
...
...
@@ -198,7 +196,17 @@
filteredSearchInput.addEventListener('input', this.setDropdown.bind(this));
filteredSearchInput.addEventListener('input', toggleClearSearchButton);
filteredSearchInput.addEventListener('keydown', this.checkForEnter.bind(this));
document.querySelector('.clear-search').addEventListener('click', clearSearch);
document.querySelector('.clear-search').addEventListener('click', this.clearSearch.bind(this));
}
clearSearch(e) {
e.stopPropagation();
e.preventDefault();
document.querySelector('.filtered-search').value = '';
document.querySelector('.clear-search').classList.add('hidden');
dropdownHint.resetFilters();
this.loadDropdown('hint', true);
}
checkDropdownToken(e) {
...
...
@@ -208,7 +216,6 @@
// Check for dropdown token
if (lastToken[lastToken.length - 1] === ':') {
const token = lastToken.slice(0, -1);
}
}
...
...
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