diff --git a/js/apps/system/aardvark/lib/foxxTemplateEngine.js b/js/apps/system/aardvark/lib/foxxTemplateEngine.js index 9bf26d25bb..5d76de1f22 100644 --- a/js/apps/system/aardvark/lib/foxxTemplateEngine.js +++ b/js/apps/system/aardvark/lib/foxxTemplateEngine.js @@ -9,11 +9,11 @@ this.applicationContext = opts.applicationContext; this.path = opts.path; this.name = opts.name; - this.collectionNames = opts.collectionNames; this.authenticated = opts.authenticated; this.author = opts.author; this.description = opts.description; this.license = opts.license; + this.determineFromCollectionNames(opts.collectionNames); this._path = this.applicationContext.foxxFilename("templates"); this.folder = fs.join(this.path, this.name); }; @@ -21,7 +21,6 @@ _.extend(Engine.prototype, { write: function() { fs.makeDirectory(this.folder); - fs.write(fs.join(this.folder, "manifest.json"), this.buildManifest()); }, @@ -29,6 +28,19 @@ return _.template(fs.read(fs.join(this._path, name))); }, + determineFromCollectionNames: function (collectionNames) { + this.collectionNames = []; + this.controllers = []; + + _.each(collectionNames, function (collectionName) { + this.collectionNames.push(collectionName); + this.controllers.push({ + url: '/' + collectionName, + path: 'controllers/' + collectionName + '.js' + }); + }, this); + }, + buildManifest: function() { var manifest = this.template("manifest.json.tmpl"); @@ -36,7 +48,8 @@ name: this.name, description: this.description, author: this.author, - license: this.license + license: this.license, + controllers: this.controllers }); } }); diff --git a/js/apps/system/aardvark/templates/manifest.json.tmpl b/js/apps/system/aardvark/templates/manifest.json.tmpl index 4b436bd9d7..5fcf591211 100644 --- a/js/apps/system/aardvark/templates/manifest.json.tmpl +++ b/js/apps/system/aardvark/templates/manifest.json.tmpl @@ -10,6 +10,9 @@ ], "controllers": { + <% _.each(controllers, function (controller) { %> + "<%= controller.url %>": "<%= controller.path %>", + <% }); %> }, "setup": "",