aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/routes
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-19 11:22:21 +1000
committerYuchen Pei <hi@ypei.me>2022-09-19 11:22:21 +1000
commitef1b927861f9a949aed20341144ffb5bfd42f038 (patch)
tree48bd4688928546bedc6504aad76bf6e0327fcef9 /javascript/app/routes
parent117850d8f659517cb818a857dc04c8f5157795c4 (diff)
Removing the web client
Diffstat (limited to 'javascript/app/routes')
-rw-r--r--javascript/app/routes/application.js3
-rw-r--r--javascript/app/routes/package.js49
-rw-r--r--javascript/app/routes/package/index.js7
-rw-r--r--javascript/app/routes/package/search.js36
-rw-r--r--javascript/app/routes/package/show/file.js27
-rw-r--r--javascript/app/routes/package/show/index.js7
-rw-r--r--javascript/app/routes/packages.js19
-rw-r--r--javascript/app/routes/search.js42
8 files changed, 0 insertions, 190 deletions
diff --git a/javascript/app/routes/application.js b/javascript/app/routes/application.js
deleted file mode 100644
index 279bd32..0000000
--- a/javascript/app/routes/application.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Ember from 'ember';
-export default Ember.Route.extend({
-});
diff --git a/javascript/app/routes/package.js b/javascript/app/routes/package.js
deleted file mode 100644
index 6abc603..0000000
--- a/javascript/app/routes/package.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import Ember from 'ember';
-import {urls} from '../utils/api-urls';
-
-export default Ember.Route.extend({
- store : Ember.inject.service('store'),
- model (params) {
- return this.get('store').loadPackage(params.packageId)
- .catch((e) => {console.log(e);this.transitionTo("/package-not-found");});
- },
- setupController(controller, model) {
- this._super(controller, model);
- controller.set('bottomPanelVisible',false);
- },
- actions : {
- openFile (filePath) {
- this.transitionTo('package.show.file',filePath);
- },
- fileOpened (filePath) {
- if(this.get('controller')) {
- this.set('controller.currentFile',filePath);
- }
- },
- updateReferences(packageId,externalId,occName,locationInfo,noScrollIntoView) {
- this.get('store').loadGlobalReferences(externalId).then((refs) => {
- Ember.run.next(this,() => {
- this.set('controller.globalReferences',refs);
- if(!noScrollIntoView) {
- Ember.run.schedule('afterRender', () => {
- const element = document.getElementById('references-package-'+packageId);
- if(element) {
- element.scrollIntoView();
- }
- });
- }
- });
- });
- this.set('controller.packageId',packageId);
- this.set('controller.externalId',externalId);
- this.set('controller.occName',occName);
- this.set('controller.locationInfo',locationInfo);
- this.set('controller.bottomPanelVisible',true);
- this.set('controller.referencesUrl',urls.referencesUrl(packageId,externalId)+"?per_page=50");
- },
- didTransition() {
- document.title = this.currentModel.id;
- return true;
- }
- }
-});
diff --git a/javascript/app/routes/package/index.js b/javascript/app/routes/package/index.js
deleted file mode 100644
index 15ff8a5..0000000
--- a/javascript/app/routes/package/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- afterModel : function (model,transition) {
- transition.send("fileOpened",null);
- }
-});
diff --git a/javascript/app/routes/package/search.js b/javascript/app/routes/package/search.js
deleted file mode 100644
index 058f9ec..0000000
--- a/javascript/app/routes/package/search.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import Ember from 'ember';
-import {urls} from '../../utils/api-urls';
-import {goToDefinition} from '../../utils/go-to-definition';
-
-export default Ember.Route.extend({
- store : Ember.inject.service('store'),
- model (params) {
- return {
- query: params.query,
- url: urls.identifierSearchUrl(this.modelFor('package').id,params.query)+"?per_page=20"
- };
- },
- afterModel () {
- const onmouseup = (event) => {
- // This makes links in documentation clickable
- if(event.target.dataset.location) {
- let location;
- try {
- location = JSON.parse(event.target.dataset.location);
- } catch (e) {
- console.log(e);
- }
- if(location) {
- goToDefinition(this.get('store'),location,event.which);
- }
- }
- };
- this._onmouseup = onmouseup;
- document.addEventListener('mouseup',onmouseup);
- },
- deactivate() {
- if(this._onmouseup) {
- document.removeEventListener('mouseup',this._onmouseup);
- }
- }
-});
diff --git a/javascript/app/routes/package/show/file.js b/javascript/app/routes/package/show/file.js
deleted file mode 100644
index 568d288..0000000
--- a/javascript/app/routes/package/show/file.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- store : Ember.inject.service(),
- model : function (params) {
- const packageInfo = this.modelFor('package');
- if(packageInfo.modules[params.filePath]) {
- return this.get('store').loadHaskellModule(packageInfo.id,params.filePath)
- .catch((e) => {console.log(e);this.transitionTo("/not-found");});
- } else {
- return this.get('store').loadFile(packageInfo.id,params.filePath)
- .then((result) => {
- document.title = packageInfo.id;
- return result;
- })
- .catch((e) => {console.log(e);this.transitionTo("/not-found");});
- }
- },
- afterModel (model) {
- document.title = model.id + " - " + this.modelFor('package').id;
- },
- actions : {
- didTransition : function () {
- this.send("fileOpened",this.currentModel.id);
- }
- }
-});
diff --git a/javascript/app/routes/package/show/index.js b/javascript/app/routes/package/show/index.js
deleted file mode 100644
index 15ff8a5..0000000
--- a/javascript/app/routes/package/show/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
- afterModel : function (model,transition) {
- transition.send("fileOpened",null);
- }
-});
diff --git a/javascript/app/routes/packages.js b/javascript/app/routes/packages.js
deleted file mode 100644
index 34a454d..0000000
--- a/javascript/app/routes/packages.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import Ember from 'ember';
-import {urls} from '../utils/api-urls';
-import config from '../config/environment';
-
-export default Ember.Route.extend({
- model () {
- return Ember.$.getJSON(urls.packagesUrl);
- },
- setupController(controller, model) {
- this._super(controller, model);
- controller.set('packages',model);
- controller.set('createSearchUrlFunction',(query) => {
- return urls.globalIdentifiersUrl(query);
- });
- },
- afterModel () {
- document.title = config.APP.title;
- }
-});
diff --git a/javascript/app/routes/search.js b/javascript/app/routes/search.js
deleted file mode 100644
index 3ad8905..0000000
--- a/javascript/app/routes/search.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import Ember from 'ember';
-import {urls} from '../utils/api-urls';
-import {goToDefinition} from '../utils/go-to-definition';
-
-export default Ember.Route.extend({
- store : Ember.inject.service('store'),
- model (params) {
- return {
- query: params.query,
- url: urls.globalIdentifiersUrl(params.query)+"?per_page=20"
- };
- },
- setupController(controller, model) {
- this._super(controller, model);
- controller.set('createSearchUrlFunction',(query) => {
- return urls.globalIdentifiersUrl(query);
- });
- },
- afterModel () {
- const onmouseup = (event) => {
- // This makes links in documentation clickable
- if(event.target.dataset.location) {
- let location;
- try {
- location = JSON.parse(event.target.dataset.location);
- } catch (e) {
- console.log(e);
- }
- if(location) {
- goToDefinition(this.get('store'),location,event.which);
- }
- }
- };
- this._onmouseup = onmouseup;
- document.addEventListener('mouseup',onmouseup);
- },
- deactivate() {
- if(this._onmouseup) {
- document.removeEventListener('mouseup',this._onmouseup);
- }
- }
-});