[Pkg-owncloud-commits] [owncloud] 341/457: Disable search field in case there is no search available to the current selected app - fixes #14544

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 0dd990839eb5da1af0e6671f7d7a815328560330
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Mon Jun 8 20:18:41 2015 +0200

    Disable search field in case there is no search available to the current selected app - fixes #14544
---
 core/search/js/search.js | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/core/search/js/search.js b/core/search/js/search.js
index cb3c3bc..4d0cf69 100644
--- a/core/search/js/search.js
+++ b/core/search/js/search.js
@@ -94,6 +94,9 @@
 			/**
 			 * Do a search query and display the results
 			 * @param {string} query the search query
+			 * @param inApps
+			 * @param page
+			 * @param size
 			 */
 			this.search = function(query, inApps, page, size) {
 				if (query) {
@@ -160,7 +163,8 @@
 			var summaryAndStatusHeight = 118;
 
 			function isStatusOffScreen() {
-				return $searchResults.position() && ($searchResults.position().top + summaryAndStatusHeight > window.innerHeight);
+				return $searchResults.position() &&
+					($searchResults.position().top + summaryAndStatusHeight > window.innerHeight);
 			}
 
 			function placeStatus() {
@@ -252,10 +256,11 @@
 			 * Event handler for when scrolling the list container.
 			 * This appends/renders the next page of entries when reaching the bottom.
 			 */
-			function onScroll(e) {
+			function onScroll() {
 				if ($searchResults && lastQuery !== false && lastResults.length > 0) {
 					var resultsBottom = $searchResults.offset().top + $searchResults.height();
-					var containerBottom = $searchResults.offsetParent().offset().top + $searchResults.offsetParent().height();
+					var containerBottom = $searchResults.offsetParent().offset().top +
+						$searchResults.offsetParent().height();
 					if ( resultsBottom < containerBottom * 1.2 ) {
 						self.search(lastQuery, lastInApps, lastPage + 1);
 					}
@@ -289,7 +294,7 @@
 				event.preventDefault();
 			});
 
-			$searchBox.on('search', function (event) {
+			$searchBox.on('search', function () {
 				if($searchBox.val() === '') {
 					if(self.hasFilter(getCurrentApp())) {
 						self.getFilter(getCurrentApp())('');
@@ -359,6 +364,14 @@
 			placeStatus();
 
 			OC.Plugins.attach('OCA.Search', this);
+
+			// hide search file if search is not enabled
+			if(self.hasFilter(getCurrentApp())) {
+				return;
+			}
+			if ($searchResults.length === 0) {
+				$searchBox.hide();
+			}
 		}
 	};
 	OCA.Search = Search;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list