diff options
Diffstat (limited to 'javascript/app/controllers')
-rw-r--r-- | javascript/app/controllers/packages.js | 19 | ||||
-rw-r--r-- | javascript/app/controllers/search.js | 28 |
2 files changed, 46 insertions, 1 deletions
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; + } + } +}); |