Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1692)

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 10388142: Show the message 'No files match "abc"' if the search results are empty. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_manager.js
===================================================================
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 137095)
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy)
@@ -4337,15 +4337,31 @@
};
FileManager.prototype.onSearchBoxUpdate_ = function(event) {
- var searchString = this.dialogDom_.querySelector('#search-box').value;
+ var searchString = this.document_.getElementById('search-box').value;
SeRya 2012/05/15 14:08:03 var searchBox = this.document_.getElementById('sea
Oleg Eterevsky 2012/05/15 14:16:51 Why? I don't need it.
if (searchString) {
this.directoryModel_.addFilter(
'searchbox',
function(e) {
return e.name.substr(0, searchString.length) == searchString;
});
+
+ this.reportEmptySearchResults_ = function() {
+ if (this.directoryModel_.getFileList().length === 0) {
+ var text = strf('SEARCH_NO_MATCHING_FILES', searchString);
+ this.document_.getElementById('no-search-results').innerHTML = text;
+ this.document_.getElementById('no-search-results').removeAttribute(
SeRya 2012/05/15 14:08:03 .hidden = false;
Oleg Eterevsky 2012/05/15 14:16:51 Done.
+ 'hidden');
+ }
+ }.bind(this);
+
+ this.directoryModel_.addEventListener(
+ 'rescan-completed', this.reportEmptySearchResults_);
SeRya 2012/05/15 14:08:03 The 'splice' event of fileList is better because i
Oleg Eterevsky 2012/05/15 14:16:51 I don't believe there is any difference.
} else {
this.directoryModel_.removeFilter('searchbox');
+ this.document_.getElementById('no-search-results').setAttribute('hidden',
SeRya 2012/05/15 14:08:03 There is a setter for 'hidden'. Use ".hidden = tru
Oleg Eterevsky 2012/05/15 14:16:51 Done.
+ 'true');
+ this.directoryModel_.removeEventListener(
+ 'rescan-completed', this.reportEmptySearchResults_);
}
};

Powered by Google App Engine
This is Rietveld 408576698