Commit 813d65f4 authored by Ricco Førgaard's avatar Ricco Førgaard

Changed how the config is handled.

parent 304224c8
......@@ -5,7 +5,6 @@ components
.classpath
.project
tags
config.js
*.swp
*.iml
*.sublime-project
......
......@@ -4,10 +4,7 @@ To get up and running:
$ bower install
$ open index.html
If your REST server expects anything on the URL path (such as `/api/study/list` instead of `/study/list`), add a `config.js` on the project root:
$ var config = {
$ 'baseUrl': '/my-prefix/'
$ };
You can set `baseUrl` to a URL if you wish.
If your REST server expects a namespace on the URL path (such as
`/api/study/list` instead of `/study/list`), add it to the `config/config.js`
file. You can specify either a namespace (`/api/`) or a URL
(`http://my-host:8080/api`).
define(['dojo/_base/declare'], function(declare) {
return declare('nesstarconfig.config', null, {
/* API URL namespace */
baseUrl: '/api/'
});
});
\ No newline at end of file
......@@ -9,15 +9,7 @@
<link rel="stylesheet" type="text/css" href="css/overlay.css"></link>
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon.png">
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript">
if (!window.nesstartouch) {
window.nesstartouch = {};
}
if (config) {
window.nesstartouch.config = config;
}
</script>
</head>
......@@ -35,6 +27,10 @@
{
name: 'nesstartouch',
location: base + '/js/'
},
{
name: 'nesstarconfig',
location: base + '/config/'
}
]
};
......@@ -42,7 +38,6 @@
</script>
<script src="components/dojo/dojo.js" data-dojo-config="async: true"></script>
<script>
var splash;
require(['dojo/_base/declare', 'dojo/dom', 'dojo/dom-style', 'dojo/_base/fx'],
......
define(['dojo/_base/declare',
'dojo/_base/lang',
'dojo/request',], function(declare, lang, request) {
'dojo/request',
'nesstarconfig/config'], function(declare, lang, request, config) {
return declare('nesstartouch._RestMixin', null, {
defaultOptions: {
method: 'GET',
......@@ -39,8 +40,8 @@ define(['dojo/_base/declare',
},
addBaseUrl: function(originalUrl) {
if (window.nesstartouch.config.baseUrl) {
return window.nesstartouch.config.baseUrl + originalUrl;
if (config) {
return config.baseUrl + originalUrl;
}
return originalUrl;
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment