summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2015-01-02 12:50:21 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2015-01-02 12:50:21 +0100
commit0cca9e26c41a1957b3a574d33b3835ea76c63e13 (patch)
treeb4795ecd6a32dddebcd9e359343579d0ba73ab75
parent9e3f4e043f6204a336a6efc4a9c39f23723d0522 (diff)
downloadnextcloud-server-0cca9e26c41a1957b3a574d33b3835ea76c63e13.tar.gz
nextcloud-server-0cca9e26c41a1957b3a574d33b3835ea76c63e13.zip
show no files found message
-rw-r--r--apps/files/css/files.css23
-rw-r--r--apps/files/js/filelist.js5
-rw-r--r--apps/files/js/search.js8
-rw-r--r--apps/files/templates/list.php6
-rw-r--r--search/js/search.js27
5 files changed, 51 insertions, 18 deletions
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index a75ad57c833..a6a28b594ae 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -599,3 +599,26 @@ table.dragshadow td.size {
.mask.transparent{
opacity: 0;
}
+
+#nofilterresults {
+ font-size: 16px;
+ color: #888;
+ position: absolute;
+ text-align: center;
+ top: 30%;
+ width: 100%;
+}
+#nofilterresults h2 {
+ font-size: 22px;
+ margin-bottom: 10px;
+}
+#nofilterresults [class^="icon-"],
+#nofilterresults [class*=" icon-"] {
+ background-size: 64px;
+ height: 64px;
+ width: 64px;
+ margin: 0 auto 15px;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
+ filter: alpha(opacity=50);
+ opacity: .5;
+} \ No newline at end of file
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index e01a029bc97..48c990872d1 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1685,9 +1685,14 @@
if (this._filter && this.fileSummary.summary.totalDirs + this.fileSummary.summary.totalFiles === 0) {
this.$el.find('#filestable thead th').addClass('hidden');
this.$el.find('#emptycontent').addClass('hidden');
+ if ( $('#searchresults').length === 0 || $('#searchresults').hasClass('hidden')) {
+ this.$el.find('#nofilterresults').removeClass('hidden').
+ find('p').text(t('files', 'No entries in this folder match \'{filter}\'', {filter:this._filter}));
+ }
} else {
this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty);
this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty);
+ this.$el.find('#nofilterresults').addClass('hidden');
}
},
/**
diff --git a/apps/files/js/search.js b/apps/files/js/search.js
index 73eccd06dcf..ec93b937690 100644
--- a/apps/files/js/search.js
+++ b/apps/files/js/search.js
@@ -40,11 +40,18 @@
result.mime = result.mime_type;
}
}
+ function hideNoFilterResults (){
+ var $nofilterresults = $('#nofilterresults');
+ if ( ! $nofilterresults.hasClass('hidden') ) {
+ $nofilterresults.addClass('hidden');
+ }
+ }
this.renderFolderResult = function($row, result) {
if (inFileList($row, result)) {
return null;
}
+ hideNoFilterResults();
/*render folder icon, show path beneath filename,
show size and last modified date on the right */
this.updateLegacyMimetype(result);
@@ -61,6 +68,7 @@
if (inFileList($row, result)) {
return null;
}
+ hideNoFilterResults();
/*render preview icon, show path beneath filename,
show size and last modified date on the right */
this.updateLegacyMimetype(result);
diff --git a/apps/files/templates/list.php b/apps/files/templates/list.php
index 4224d9bc100..5b90e629ddd 100644
--- a/apps/files/templates/list.php
+++ b/apps/files/templates/list.php
@@ -60,6 +60,12 @@
<p><?php p($l->t('Upload some content or sync with your devices!')); ?></p>
</div>
+<div id="nofilterresults" class="hidden">
+ <div class="icon-folder"></div>
+ <h2><?php p($l->t('No files found in this folder')); ?></h2>
+ <p></p>
+</div>
+
<table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="36" data-preview-y="36">
<thead>
<tr>
diff --git a/search/js/search.js b/search/js/search.js
index b090a4ec4a8..8e576e6e8f0 100644
--- a/search/js/search.js
+++ b/search/js/search.js
@@ -109,7 +109,7 @@
}
}
// prevent double pages
- if ($searchResults && query === lastQuery && page === lastPage&& size === lastSize) {
+ if ($searchResults && query === lastQuery && page === lastPage && size === lastSize) {
return;
}
lastQuery = query;
@@ -153,9 +153,6 @@
}
}
function showResults(results) {
- if (results.length === 0) {
- return;
- }
if (!$searchResults) {
$wrapper = $('<div class="searchresults-wrapper"/>');
$('#app-content')
@@ -190,9 +187,7 @@
});
$('#app-content').on('scroll', _.bind(onScroll, this));
lastResults = results;
- $status = $searchResults.find('#status')
- .data('count', results.length)
- .text(t('search', '{count} search results in other folders', {count:results.length}, results.length));
+ $status = $searchResults.find('#status');
placeStatus();
showResults(results);
});
@@ -231,16 +226,11 @@
}
if ($row) {
$searchResults.find('tbody').append($row);
- } else {
- // not showing result, decrease counter
- var count = $status.data('count') - 1;
- if (count < 0) {
- count = 0;
- }
- $status.data('count', count)
- .text(t('search', '{count} search results in other places', {count:count}, count));
}
});
+ var count = $searchResults.find('tr.result').length;
+ $status.data('count', count)
+ .text(t('search', '{count} search results in other places', {count:count}, count));
}
function renderCurrent() {
var result = $searchResults.find('tr.result')[currentResult];
@@ -263,6 +253,7 @@
$wrapper.remove();
$searchResults = false;
$wrapper = false;
+ lastQuery = false;
}
};
@@ -292,14 +283,14 @@
var query = $searchBox.val();
if (lastQuery !== query) {
currentResult = -1;
- if(self.hasFilter(getCurrentApp())) {
- self.getFilter(getCurrentApp())(query);
- }
if (query.length > 2) {
self.search(query);
} else {
self.hideResults();
}
+ if(self.hasFilter(getCurrentApp())) {
+ self.getFilter(getCurrentApp())(query);
+ }
}
}
});