diff options
-rw-r--r-- | apps/files/js/filelist.js | 12 | ||||
-rw-r--r-- | apps/files/js/search.js | 19 | ||||
-rw-r--r-- | apps/files/templates/simplelist.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/templates/list.php | 6 | ||||
-rw-r--r-- | apps/files_trashbin/templates/index.php | 6 | ||||
-rw-r--r-- | search/js/search.js | 2 |
6 files changed, 43 insertions, 8 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 84b537fbdfe..768fc77df24 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -214,6 +214,8 @@ this.$el.on('show', this._onResize); + this.updateSearch(); + this.$fileList.on('click','td.filename>a.name', _.bind(this._onClickFile, this)); this.$fileList.on('change', 'td.filename>.selectCheckBox', _.bind(this._onClickFileCheckbox, this)); this.$el.on('urlChanged', _.bind(this._onUrlChanged, this)); @@ -274,6 +276,8 @@ containerWidth -= $('#app-navigation-toggle').width(); this.breadcrumb.setMaxWidth(containerWidth - actionsWidth - 10); + + this.updateSearch(); }, /** @@ -1703,6 +1707,14 @@ return this._filter; }, /** + * update the search object to use this filelist when filtering + */ + updateSearch:function() { + if (OCA.Search.files) { + OCA.Search.files.setFileList(this); + } + }, + /** * Update UI based on the current selection */ updateSelectionSummary: function() { diff --git a/apps/files/js/search.js b/apps/files/js/search.js index 2c3c42cf496..5fb10ef34cd 100644 --- a/apps/files/js/search.js +++ b/apps/files/js/search.js @@ -21,6 +21,8 @@ */ Files.prototype = { + fileList: null, + /** * Initialize the file search */ @@ -32,7 +34,7 @@ return !!OCA.Files && !!OCA.Files.App; }; function inFileList($row, result) { - return self.fileAppLoaded() && OCA.Files.App.fileList.inList(result.name); + return self.fileAppLoaded() && self.fileList.inList(result.name); } function updateLegacyMimetype(result) { // backward compatibility: @@ -79,7 +81,7 @@ $row.find('td.result a').attr('href', result.link); if (self.fileAppLoaded()) { - OCA.Files.App.fileList.lazyLoadPreview({ + self.fileList.lazyLoadPreview({ path: result.path, mime: result.mime, callback: function (url) { @@ -127,7 +129,7 @@ this.handleFolderClick = function($row, result, event) { // open folder if (self.fileAppLoaded()) { - OCA.Files.App.fileList.changeDirectory(result.path); + self.fileList.changeDirectory(result.path); return false; } else { return true; @@ -136,8 +138,8 @@ this.handleFileClick = function($row, result, event) { if (self.fileAppLoaded()) { - OCA.Files.App.fileList.changeDirectory(OC.dirname(result.path)); - OCA.Files.App.fileList.scrollTo(result.name); + self.fileList.changeDirectory(OC.dirname(result.path)); + self.fileList.scrollTo(result.name); return false; } else { return true; @@ -150,6 +152,9 @@ result.mime = result.mime_type; } }; + this.setFileList = function (fileList) { + this.fileList = fileList; + }; OC.Plugins.register('OCA.Search', this); }, @@ -157,7 +162,7 @@ var self = this; search.setFilter('files', function (query) { if (self.fileAppLoaded()) { - OCA.Files.App.fileList.setFilter(query); + self.fileList.setFilter(query); if (query.length > 2) { //search is not started until 500msec have passed window.setTimeout(function() { @@ -176,6 +181,6 @@ search.setHandler(['file', 'audio', 'image'], this.handleFileClick.bind(this)); } }; - new Files(); OCA.Search.Files = Files; + OCA.Search.files = new Files(); })(); diff --git a/apps/files/templates/simplelist.php b/apps/files/templates/simplelist.php index d806a220ac0..15bbfbb2921 100644 --- a/apps/files/templates/simplelist.php +++ b/apps/files/templates/simplelist.php @@ -11,6 +11,12 @@ <input type="hidden" name="dir" value="" id="dir"> +<div id="nofilterresults" class="hidden"> + <div class="icon-search"></div> + <h2><?php p($l->t('No entries found in this folder')); ?></h2> + <p></p> +</div> + <table id="filestable"> <thead> <tr> diff --git a/apps/files_sharing/templates/list.php b/apps/files_sharing/templates/list.php index a1d95ebc1f1..f9a6257dff2 100644 --- a/apps/files_sharing/templates/list.php +++ b/apps/files_sharing/templates/list.php @@ -8,6 +8,12 @@ <input type="hidden" name="dir" value="" id="dir"> +<div id="nofilterresults" class="hidden"> + <div class="icon-search"></div> + <h2><?php p($l->t('No entries found in this folder')); ?></h2> + <p></p> +</div> + <table id="filestable"> <thead> <tr> diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php index fe1311340c7..b89ec66b15a 100644 --- a/apps/files_trashbin/templates/index.php +++ b/apps/files_trashbin/templates/index.php @@ -12,6 +12,12 @@ <input type="hidden" name="dir" value="" id="dir"> +<div id="nofilterresults" class="hidden"> + <div class="icon-search"></div> + <h2><?php p($l->t('No entries found in this folder')); ?></h2> + <p></p> +</div> + <table id="filestable"> <thead> <tr> diff --git a/search/js/search.js b/search/js/search.js index 078fe4f82ba..d8922cf167b 100644 --- a/search/js/search.js +++ b/search/js/search.js @@ -165,7 +165,7 @@ function showResults(results) { lastResults = results; $searchResults.find('tr.result').remove(); - $searchResults.show(); + $searchResults.removeClass('hidden'); addResults(results); } function addResults(results) { |