diff --git a/src/baw.configuration.tpl.js b/src/baw.configuration.tpl.js index 4a358d5a..6336bf01 100644 --- a/src/baw.configuration.tpl.js +++ b/src/baw.configuration.tpl.js @@ -1,14 +1,58 @@ -angular.module('bawApp.configuration', []) +angular.module('bawApp.configuration', ['url']) /** * This module contains static paths that are stored centrally for easy configuration. * App dependent. * - * At least the root properties will need to be changed when the app is deployed. - * TODO: convert to template and let grunt do the hard work! + * The root properties changed when the app is built with grunt. */ .constant("conf.paths", (function () { + /** + * Joins path fragments together. + * @param {...[string]} fragments + * @returns {*} + */ + function joinPathFragments(fragments) { + fragments = Array.prototype.slice.call(arguments, 0); + + if (fragments.length === 0) { + return undefined; + } + else if (fragments.length === 1) { + return fragments[0]; + } + else { + var path = fragments[0]; + + if (path.slice(-1) === "/") { + path = path.slice(0, -1); + } + + for (var i = 1; i < fragments.length; i++) { + var f = fragments[i]; + + if ((typeof f) !== "string") { + throw "Path fragment " + f + " is not a string"; + } + + var hasFirst = f[0] === "/"; + var hasLast = (f.slice(-1))[0] === "/"; + + if (!hasFirst) { + f = "/" + f; + } + + if (hasLast && i !== (fragments.length - 1)) { + f = f.slice(0, -1); + } + + path += f; + } + + return path; + } + }; var paths = { api: { @@ -41,6 +85,10 @@ angular.module('bawApp.configuration', []) ping: "/security/sign_in", signIn: "/my_account/sign_in" } + }, + links: { + projects: '/projects', + home: '/' } }, site: { @@ -72,51 +120,7 @@ angular.module('bawApp.configuration', []) } }; - /** - * Joins path fragments together. - * @param {...[string]} fragments - * @returns {*} - */ - function joinPathFragments(fragments) { - fragments = Array.prototype.slice.call(arguments, 0); - - if (fragments.length === 0) { - return undefined; - } - else if (fragments.length === 1) { - return fragments[0]; - } - else { - var path = fragments[0]; - - if (path.slice(-1) === "/") { - path = path.slice(0, -1); - } - - for (var i = 1; i < fragments.length; i++) { - var f = fragments[i]; - - if ((typeof f) !== "string") { - throw "Path fragment " + f + " is not a string"; - } - - var hasFirst = f[0] === "/"; - var hasLast = (f.slice(-1))[0] === "/"; - - if (!hasFirst) { - f = "/" + f; - } - - if (hasLast && i !== (fragments.length - 1)) { - f = f.slice(0, -1); - } - path += f; - } - - return path; - } - } // add helper paths function recursivePath(source, root) { @@ -135,6 +139,7 @@ angular.module('bawApp.configuration', []) } recursivePath(paths.api.routes, paths.api.root); + recursivePath(paths.api.links, paths.api.root); recursivePath(paths.site.files, paths.site.root); recursivePath(paths.site.ngRoutes, paths.site.root); diff --git a/src/components/services/url.js b/src/components/services/url.js index eda1606f..c90ff88d 100644 --- a/src/components/services/url.js +++ b/src/components/services/url.js @@ -89,4 +89,5 @@ angular.module('url', ['ng']). }; + }); \ No newline at end of file diff --git a/src/index.html b/src/index.html index ca6dd6c5..e7124555 100644 --- a/src/index.html +++ b/src/index.html @@ -18,19 +18,6 @@ <% scripts.forEach( function ( file ) { %> <% }); %> - - - - - - @@ -42,12 +29,12 @@ - Bioacoustic Workbench + Bioacoustics Workbench