aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/app/controllers')
-rw-r--r--javascript/app/controllers/application.js21
-rw-r--r--javascript/app/controllers/package.js24
-rw-r--r--javascript/app/controllers/package/index.js14
-rw-r--r--javascript/app/controllers/package/search.js15
-rw-r--r--javascript/app/controllers/package/show/file.js9
-rw-r--r--javascript/app/controllers/packages.js12
6 files changed, 95 insertions, 0 deletions
diff --git a/javascript/app/controllers/application.js b/javascript/app/controllers/application.js
new file mode 100644
index 0000000..2936011
--- /dev/null
+++ b/javascript/app/controllers/application.js
@@ -0,0 +1,21 @@
+import {updateColorThemeCss,themes} from '../utils/color-themes';
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+ settings : Ember.inject.service('settings'),
+ themes: Object.values(themes),
+ init() {
+ this._super(...arguments);
+ updateColorThemeCss(this.get('settings').get('colorTheme'));
+ },
+ currentTheme: Ember.computed('settings',function() {
+ return this.get('settings.colorTheme.id');
+ }),
+ actions : {
+ themeChanged (themeId) {
+ const theme = themes[themeId];
+ this.get('settings').set('colorTheme',theme);
+ updateColorThemeCss(theme);
+ }
+ }
+});
diff --git a/javascript/app/controllers/package.js b/javascript/app/controllers/package.js
new file mode 100644
index 0000000..45a8bab
--- /dev/null
+++ b/javascript/app/controllers/package.js
@@ -0,0 +1,24 @@
+import Ember from 'ember';
+import {goToDefinition} from '../utils/go-to-definition';
+export default Ember.Controller.extend({
+ store : Ember.inject.service('store'),
+ currentFile : null,
+ loadItemsFunction : null,
+ query : null,
+ actions : {
+ searchIdentifier (query) {
+ if(query) {
+ this.set('currentFile',null);
+ document.title = this.get('model.id');
+ this.transitionToRoute('package.search',query);
+ }
+ },
+ showIdentifier (identifierInfo) {
+ goToDefinition(this.get('store'),
+ identifierInfo.locationInfo,
+ 1,//left mouse button
+ null);
+ return false;
+ }
+ }
+});
diff --git a/javascript/app/controllers/package/index.js b/javascript/app/controllers/package/index.js
new file mode 100644
index 0000000..cd02416
--- /dev/null
+++ b/javascript/app/controllers/package/index.js
@@ -0,0 +1,14 @@
+import Ember from 'ember';
+export default Ember.Controller.extend({
+ modulesFiltered : Ember.computed('model','query',function () {
+ const query = this.get('query');
+ const modules = Object.keys(this.get('model.modules')).sort();
+ if(query) {
+ const regExp = new RegExp(query,"i");
+ return modules.filter((p) => p.search(regExp) != -1);
+ } else {
+ return modules;
+ }
+ })
+});
+
diff --git a/javascript/app/controllers/package/search.js b/javascript/app/controllers/package/search.js
new file mode 100644
index 0000000..46f2efd
--- /dev/null
+++ b/javascript/app/controllers/package/search.js
@@ -0,0 +1,15 @@
+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;
+ }
+ }
+});
diff --git a/javascript/app/controllers/package/show/file.js b/javascript/app/controllers/package/show/file.js
new file mode 100644
index 0000000..c566e7e
--- /dev/null
+++ b/javascript/app/controllers/package/show/file.js
@@ -0,0 +1,9 @@
+import Ember from 'ember';
+export default Ember.Controller.extend({
+ settings : Ember.inject.service('settings'),
+ actions : {
+ findReferences(packageId,externalId,occName) {
+ this.send('updateReferences',packageId,externalId,occName);
+ }
+ }
+});
diff --git a/javascript/app/controllers/packages.js b/javascript/app/controllers/packages.js
new file mode 100644
index 0000000..a1724dd
--- /dev/null
+++ b/javascript/app/controllers/packages.js
@@ -0,0 +1,12 @@
+import Ember from 'ember';
+export default Ember.Controller.extend({
+ queryObserver : Ember.observer("query",function() {
+ Ember.run.debounce(this, () => {
+ const regExp = new RegExp(this.get('query'),"i");
+ const packages = this.get('model').filter((p) => p.name.search(regExp) != -1);
+ Ember.run.next(() => {
+ this.set('packages',packages);
+ });
+ }, 300);
+ })
+});