diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-12-04 13:43:38 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-01-02 10:28:41 +0100 |
commit | 0ba3093196fee7079583847b40ef3a8e00df47a7 (patch) | |
tree | e78036c901046bed459b4cc0c528bf2e0509ee9a /search/js | |
parent | 4b357274bb3d0295c84d9ec9ca6689270865df8f (diff) | |
download | nextcloud-server-0ba3093196fee7079583847b40ef3a8e00df47a7.tar.gz nextcloud-server-0ba3093196fee7079583847b40ef3a8e00df47a7.zip |
full page search results
Diffstat (limited to 'search/js')
-rw-r--r-- | search/js/result.js | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/search/js/result.js b/search/js/result.js index fe84aecde3e..147377aff0c 100644 --- a/search/js/result.js +++ b/search/js/result.js @@ -45,8 +45,8 @@ OC.search.showResults=function(results){ return; } if(!OC.search.showResults.loaded){ - var parent=$('<div/>'); - $('body').append(parent); + var parent=$('<div class="searchresults-wrapper"/>'); + $('#app-content').append(parent); parent.load(OC.filePath('search','templates','part.results.php'),function(){ OC.search.showResults.loaded=true; $('#searchresults').click(function(event){ @@ -74,19 +74,37 @@ OC.search.showResults=function(results){ var row=$('#searchresults tr.template').clone(); row.removeClass('template'); row.addClass('result'); - + row.data('type', typeid); row.data('name', type[i].name); + row.data('path', type[i].path); row.data('text', type[i].text); row.data('index',index); - + if (i === 0){ var typeName = OC.search.resultTypes[typeid]; row.children('td.type').text(t('lib', typeName)); } + + if (type[i].path) { + OCA.Files.App.fileList.lazyLoadPreview({ + path: type[i].path, + mime: type[i].mime_type, + callback: function (url) { + row.find('td.type').css('background-image', 'url(' + url + ')'); + } + }); + } + row.find('td.result div.name').text(type[i].name); - row.find('td.result div.text').text(type[i].text); - + row.find('td.result div.path').text(type[i].path); + if (typeof type[i].highlights === 'object') { + var highlights = type[i].highlights.join(' … '); + row.find('td.result div.text').html(highlights); + } else { + row.find('td.result div.text').text(type[i].text); + } + if (type[i].path) { var parent = OC.dirname(type[i].path); if (parent === '') { @@ -105,7 +123,7 @@ OC.search.showResults=function(results){ } else { row.find('td.result a').attr('href', type[i].link); } - + index++; /** * Give plugins the ability to customize the search results. For example: |