filter trashbin and share views

This commit is contained in:
Jörn Friedrich Dreyer 2015-01-05 13:11:50 +01:00
parent 73e17dc7e8
commit 23900a5a39
6 changed files with 43 additions and 8 deletions

View File

@ -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();
},
/**
@ -1702,6 +1706,14 @@
getFilter:function(filter) {
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
*/

View File

@ -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();
})();

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -165,7 +165,7 @@
function showResults(results) {
lastResults = results;
$searchResults.find('tr.result').remove();
$searchResults.show();
$searchResults.removeClass('hidden');
addResults(results);
}
function addResults(results) {