aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/controllers/package.js
diff options
context:
space:
mode:
authoralexwl <alexey.a.kiryushin@gmail.com>2019-02-13 23:44:05 +0300
committeralexwl <alexey.a.kiryushin@gmail.com>2019-02-13 23:44:05 +0300
commite8ded03ec40e0ba3d17b9e3e57805ce9afd43534 (patch)
treeb669e381faed51dff9445fe6d869513c46cb5589 /javascript/app/controllers/package.js
parent0b17136d965ddc602a5a0176b538bdb0a47f4d12 (diff)
Add a switch between 'search in the current package' and 'search in all packages' on the package page
Diffstat (limited to 'javascript/app/controllers/package.js')
-rw-r--r--javascript/app/controllers/package.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/javascript/app/controllers/package.js b/javascript/app/controllers/package.js
index 45a8bab..278899f 100644
--- a/javascript/app/controllers/package.js
+++ b/javascript/app/controllers/package.js
@@ -1,16 +1,35 @@
import Ember from 'ember';
import {goToDefinition} from '../utils/go-to-definition';
+import {urls} from '../utils/api-urls';
+
export default Ember.Controller.extend({
store : Ember.inject.service('store'),
currentFile : null,
loadItemsFunction : null,
query : null,
+ searchMode : "currentPackage",
+ createSearchUrlFunction : Ember.computed("searchMode",function() {
+ const packageId = this.get('model.id');
+ const query = this.get('query');
+ if(this.get('searchMode') === "currentPackage") {
+ return (query) => urls.identifierSearchUrl(packageId,query);
+ } else {
+ return (query) => urls.globalIdentifiersUrl(query);
+ }
+ }),
actions : {
+ searchModeChanged () {
+
+ },
searchIdentifier (query) {
if(query) {
this.set('currentFile',null);
- document.title = this.get('model.id');
- this.transitionToRoute('package.search',query);
+ document.title = this.get('model.id');
+ if(this.get('searchMode') === "currentPackage") {
+ this.transitionToRoute('package.search',query);
+ } else {
+ this.transitionToRoute('search',query);
+ }
}
},
showIdentifier (identifierInfo) {