Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/search
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-08-01 00:24:52 +0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-17 20:40:51 +0400
commitb40925ae1747ae44a52fb1f8dcf7645d022c6f13 (patch)
tree2f385e6b79de01305aa718c197fdc3c85e5ff4cd /search
parent9d18e16c77e8c2690dd23dd19ca1f8e1968161c8 (diff)
initial scrollto implementation:
use places/folder icon, move link construction to JS, only show icon on hover, use 'searchresult' as css class name, add filter/unfilter methods, highlight searched files in current filelist only filter when correct FileList is present
Diffstat (limited to 'search')
-rw-r--r--search/css/results.css22
-rw-r--r--search/js/result.js38
-rw-r--r--search/templates/part.results.php3
3 files changed, 54 insertions, 9 deletions
diff --git a/search/css/results.css b/search/css/results.css
index 4ae7d67afb3..8a32b0b995d 100644
--- a/search/css/results.css
+++ b/search/css/results.css
@@ -14,7 +14,7 @@
position:fixed;
right:0;
text-overflow:ellipsis;
- top:20px;
+ top:45px;
width:380px;
z-index:75;
}
@@ -43,10 +43,16 @@
}
#searchresults td {
- vertical-align:top;
padding:0 .3em;
+ height: 32px;
+}
+#searchresults tr.template {
+ display: none;
}
+#searchresults td.result {
+ width:250px;
+}
#searchresults td.result div.text {
padding-left:1em;
white-space:nowrap;
@@ -56,6 +62,18 @@
cursor:pointer;
}
+#searchresults td.container {
+ width:20px;
+}
+
+#searchresults td.container img {
+ vertical-align: middle;
+ display:none;
+}
+#searchresults tr:hover td.container img {
+ display:inline;
+}
+
#searchresults td.type {
border-bottom:none;
border-right:1px solid #aaa;
diff --git a/search/js/result.js b/search/js/result.js
index 78fa8efc8e9..78d9149f220 100644
--- a/search/js/result.js
+++ b/search/js/result.js
@@ -8,15 +8,23 @@ OC.search.catagorizeResults=function(results){
types[type].push(results[i]);
}
return types;
-}
+};
OC.search.hide=function(){
$('#searchresults').hide();
if($('#searchbox').val().length>2){
$('#searchbox').val('');
+ if (FileList && typeof FileList.unfilter === 'function') { //TODO add hook system
+ FileList.unfilter();
+ }
};
-}
+ if ($('#searchbox').val().length === 0) {
+ if (FileList && typeof FileList.unfilter === 'function') { //TODO add hook system
+ FileList.unfilter();
+ }
+ }
+};
OC.search.showResults=function(results){
- if(results.length==0){
+ if(results.length === 0){
return;
}
if(!OC.search.showResults.loaded){
@@ -30,6 +38,9 @@ OC.search.showResults=function(results){
});
$(document).click(function(event){
OC.search.hide();
+ if (FileList && typeof FileList.unfilter === 'function') { //TODO add hook system
+ FileList.unfilter();
+ }
});
OC.search.lastResults=results;
OC.search.showResults(results);
@@ -46,12 +57,27 @@ OC.search.showResults=function(results){
var row=$('#searchresults tr.template').clone();
row.removeClass('template');
row.addClass('result');
- if (i == 0){
+ if (i === 0){
row.children('td.type').text(name);
}
row.find('td.result a').attr('href',type[i].link);
row.find('td.result div.name').text(type[i].name);
row.find('td.result div.text').text(type[i].text);
+ if (type[i].container) {
+ var td = row.find('td.container');
+ td.append('<a><img></img></a>');
+ td.find('img').attr('src',OC.imagePath('core','places/folder'));
+ var containerName = OC.basename(type[i].container);
+ if (containerName === '') {
+ containerName = '/';
+ }
+ var containerLink = OC.linkTo('files','index.php')
+ +'?dir='+encodeURIComponent(type[i].container)
+ +'&scrollto='+encodeURIComponent(type[i].name);
+ row.find('td.container a')
+ .attr('href',containerLink)
+ .attr('title',t('core','Show in {folder}',{folder: containerName}));
+ }
row.data('index',index);
index++;
if(OC.search.customResults[name]){//give plugins the ability to customize the entries in here
@@ -62,7 +88,7 @@ OC.search.showResults=function(results){
}
}
}
-}
+};
OC.search.showResults.loaded=false;
OC.search.renderCurrent=function(){
@@ -71,4 +97,4 @@ OC.search.renderCurrent=function(){
$('#searchresults tr.result').removeClass('current');
$(result).addClass('current');
}
-}
+};
diff --git a/search/templates/part.results.php b/search/templates/part.results.php
index 9e39a1c2c8b..1469e3468d3 100644
--- a/search/templates/part.results.php
+++ b/search/templates/part.results.php
@@ -1,7 +1,7 @@
<div id='searchresults'>
<table>
<tbody>
- <tr class='template '>
+ <tr class='template'>
<td class='type'></td>
<td class='result'>
<a>
@@ -9,6 +9,7 @@
<div class='text'></div>
</a>
</td>
+ <td class='container'></td>
</tr>
</tbody>
</table>