incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject git commit: Added the enter key to trigger search
Date Thu, 12 Jun 2014 20:07:25 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/apache-blur-0.2 d383f8157 -> 297ed8f56


Added the enter key to trigger search


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/297ed8f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/297ed8f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/297ed8f5

Branch: refs/heads/apache-blur-0.2
Commit: 297ed8f56d2af2650412713bd964a1327498ca11
Parents: d383f81
Author: Chris Rohr <rohr.chris@gmail.com>
Authored: Thu Jun 12 16:07:13 2014 -0400
Committer: Chris Rohr <rohr.chris@gmail.com>
Committed: Thu Jun 12 16:07:13 2014 -0400

----------------------------------------------------------------------
 .../src/main/webapp/js/blurconsole.search.js    | 44 ++++++++++++--------
 1 file changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/297ed8f5/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/js/blurconsole.search.js b/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
index a80d9ff..b81ea70 100644
--- a/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
+++ b/contrib/blur-console/src/main/webapp/js/blurconsole.search.js
@@ -60,7 +60,9 @@ blurconsole.search = (function () {
 			$resultsHolder : $('#results'),
 			$optionsDisplay : $('#searchOptionsDisplay'),
 			$countHolder : $('#resultCount'),
-			$facetTrigger : $('#facetTrigger')
+			$facetTrigger : $('#facetTrigger'),
+			$optionsTrigger: $('#searchOptionsTrigger'),
+			$searchTrigger : $('#searchTrigger')
 		};
 	}
 
@@ -164,33 +166,41 @@ blurconsole.search = (function () {
 	};
 
 	function _registerPageEvents() {
-		$('#searchTrigger').on('click', _sendSearch);
-		$('#queryField').typeahead({}, _queryTypeaheadDataset);
-		$('#results').on('shown.bs.collapse', '.panel-collapse:not(.loaded)', _getMoreData);
-		$('#results').on('click', '.nextPage', _getMoreData);
-		$('#searchOptionsTrigger').popover({
+		jqueryMap.$searchTrigger.on('click', _sendSearch);
+		jqueryMap.$queryField.typeahead({}, _queryTypeaheadDataset);
+		jqueryMap.$queryField.on('keyup', function(evt) {
+			if (evt.keyCode === 13) {
+				_sendSearch();
+			}
+		});
+		jqueryMap.$resultsHolder.on('shown.bs.collapse', '.panel-collapse:not(.loaded)', _getMoreData);
+		jqueryMap.$resultsHolder.on('click', '.nextPage', _getMoreData);
+		jqueryMap.$optionsTrigger.popover({
 			html: true,
 			placement: 'bottom',
 			title: 'Extra Search Options',
 			container: 'body',
 			content: configMap.optionsHtml
 		});
-		$('#searchOptionsTrigger').on('shown.bs.popover', _updateOptionPopover);
+		jqueryMap.$optionsTrigger.on('shown.bs.popover', _updateOptionPopover);
 		$(document).on('change', '.popover select', _persistOptions);
 		jqueryMap.$facetTrigger.on('click', _popupFacetDialog);
 	}
 
 	function _unregisterPageEvents() {
-		$('#searchTrigger').off('click');
-		$('#queryField').typeahead('destroy');
-		$('#results').off('shown.bs.collapse');
-		$('#results').off('click');
-		$('#searchOptionsTrigger').popover('destroy');
-		$('#searchOptionsTrigger').off('shown.bs.popover');
-		$(document).off('change');
-		//jqueryMap.$facetTrigger.off('click');
+		if (jqueryMap.$searchTrigger) {
+			jqueryMap.$searchTrigger.off('click');
+			jqueryMap.$queryField.typeahead('destroy');
+			jqueryMap.$queryField.off('keyup');
+			jqueryMap.$resultsHolder.off('shown.bs.collapse');
+			jqueryMap.$resultsHolder.off('click');
+			jqueryMap.$optionsTrigger.popover('destroy');
+			jqueryMap.$optionsTrigger.off('shown.bs.popover');
+			$(document).off('change');
+			//jqueryMap.$facetTrigger.off('click');
+		}
 	}
-    
+
     function _getColList(row) {
 		var cols = blurconsole.utils.reject(blurconsole.utils.keys(row), function(i) {
 			return i === 'recordid';
@@ -205,7 +215,7 @@ blurconsole.search = (function () {
 		cols = ['recordid'].concat(cols);
 		return cols;
 	}
-    
+
     //------------------------------ Event Handlers and DOM Methods ---------------------
 	function _updateOptionDisplay() {
 		var displayText = '';


Mime
View raw message