diff --git a/frontend/app/global.js b/frontend/app/global.js index e011d1e81da..707ddce209b 100644 --- a/frontend/app/global.js +++ b/frontend/app/global.js @@ -69,3 +69,8 @@ require('angular-sanitize'); require('angular-ui-select/dist/select'); require('angular-ui-select/dist/select.css'); + +require('angular-hypermedia'); +require('linkheader-parser'); +require('mediatype-parser'); +require('expose?UriTemplate!uri-templates'); diff --git a/frontend/bower.json b/frontend/bower.json index b3a2ed96362..6d67e58a135 100644 --- a/frontend/bower.json +++ b/frontend/bower.json @@ -30,7 +30,8 @@ "bourbon": "~4.2.1", "angular-ui-select": "~0.13.2", "mousetrap": "~1.4.6", - "ng-file-upload": "~5.0.9" + "ng-file-upload": "~5.0.9", + "angular-hypermedia": "~0.7.1" }, "devDependencies": { "mocha": "~1.14.0", diff --git a/frontend/doc/API.md b/frontend/doc/API.md index 1a7710b2c8e..c725cdb463b 100644 --- a/frontend/doc/API.md +++ b/frontend/doc/API.md @@ -68,6 +68,11 @@ This is in principle a very good concept to delegate responsibility of inference ## Using hyperagent.js +**Deprecation Notice:** +Please consider using `angular-hypermedia`, as it is a better suited solution than `hyperagent`. +[Using angular-hypermedia](#angular-hypermedia). + + For all practical purposes, the OpenProject frontend uses a fork of [`hyperagent.js`](https://github.com/weluse/hyperagent) (actually [this one is used](https://github.com/manwithtwowatches/hyperagent)). `hyperagent.js` aims to provide an interface to a structed JSON response, providing a resource object automatically. While this is a nice goal, the current implementation used is not complete. @@ -89,3 +94,11 @@ var addAttachmentPath = workPackage._links.addAttachment.href; One of the minor drawbacks of `hyperagent.js` is that it (_read_: the fork used) only supports `GET` requests at the moment and one has to awkwardly inject the `method` desired into the `options` of the AJAX call made (see also the `setup` method of `hal-api-resource.js`, as well as an example in `loadWorkPackageForm` in `./frontend/app/services/work-package-service.js`). __Note__: The long term goal should be to leverage `angular.$http` and make the calls accordingly. One of the short term goals should be to remove duplication introduced when building requests via the `HALAPIResource`. + + +## Using angular-hypermedia + +Please read the documentation for usage details [`angular-hypermedia`](https://github.com/jcassee/angular-hypermediahttps://github.com/jcassee/angular-hypermedia). + +**TODO** +_Add usage example for `angular-hypermedia`_