From d6a64db1ced3d3577886a7aec140a5174cbceb48 Mon Sep 17 00:00:00 2001 From: alexwl Date: Wed, 6 Feb 2019 21:42:29 +0300 Subject: Add identifier search in all indexed packages --- javascript/app/controllers/packages.js | 19 ++++++++++++++++++- javascript/app/controllers/search.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 javascript/app/controllers/search.js (limited to 'javascript/app/controllers') diff --git a/javascript/app/controllers/packages.js b/javascript/app/controllers/packages.js index a1724dd..614ecd8 100644 --- a/javascript/app/controllers/packages.js +++ b/javascript/app/controllers/packages.js @@ -1,4 +1,6 @@ import Ember from 'ember'; +import {goToDefinition} from '../utils/go-to-definition'; + export default Ember.Controller.extend({ queryObserver : Ember.observer("query",function() { Ember.run.debounce(this, () => { @@ -8,5 +10,20 @@ export default Ember.Controller.extend({ this.set('packages',packages); }); }, 300); - }) + }), + actions: { + searchIdentifier (query) { + if(query) { + document.title = "Haskell code explorer"; + this.transitionToRoute('search',query); + } + }, + showIdentifier (identifierInfo) { + goToDefinition(this.get('store'), + identifierInfo.locationInfo, + 1,//left mouse button + null); + return false; + } + } }); diff --git a/javascript/app/controllers/search.js b/javascript/app/controllers/search.js new file mode 100644 index 0000000..5d77770 --- /dev/null +++ b/javascript/app/controllers/search.js @@ -0,0 +1,28 @@ +import Ember from 'ember'; +import {goToDefinition} from '../utils/go-to-definition'; + +export default Ember.Controller.extend({ + store : Ember.inject.service('store'), + actions : { + goToDefinition (locationInfo,event) { + goToDefinition(this.get('store'), + locationInfo, + event.which, + null); + return false; + }, + searchIdentifier (query) { + if(query) { + document.title = "Haskell code explorer"; + this.transitionToRoute('search',query); + } + }, + showIdentifier (identifierInfo) { + goToDefinition(this.get('store'), + identifierInfo.locationInfo, + 1,//left mouse button + null); + return false; + } + } +}); -- cgit v1.2.3