mirror of https://gitee.com/bigwinds/arangodb
Added an automatic dev app reloading.
This commit is contained in:
parent
987dec185e
commit
85da13197d
|
@ -61,6 +61,7 @@ controller.post("/generate", function(req, res) {
|
|||
|
||||
if (isDevMode()) {
|
||||
FoxxManager.devSetup(conf.get("name"));
|
||||
internal.executeGlobalContextFunction("reloadRouting");
|
||||
} else {
|
||||
// TODO Zip and ship it
|
||||
}
|
||||
|
|
|
@ -634,10 +634,13 @@
|
|||
author: $("#new-app-author").val(),
|
||||
license: $("#new-app-license").val(),
|
||||
description: $("#new-app-description").val()
|
||||
};
|
||||
},
|
||||
self = this;
|
||||
console.log(info);
|
||||
$.post("templates/generate", JSON.stringify(info), function(a) {
|
||||
alert("GENERATOOOO!", a);
|
||||
//TODO Error Handling
|
||||
window.modalView.hide();
|
||||
self.reload();
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -56,20 +56,24 @@
|
|||
this.models = [];
|
||||
|
||||
_.each(collectionNames, function (collectionName) {
|
||||
var modelName = i.singularize(collectionName),
|
||||
var modelBase = i.singularize(collectionName).substr(1),
|
||||
collectionStart,
|
||||
repositoryBase = collectionName.substr(1),
|
||||
repositoryName,
|
||||
repositoryPath,
|
||||
repositoryInstance,
|
||||
modelPath;
|
||||
modelPath,
|
||||
modelName,
|
||||
modelInstance;
|
||||
collectionStart = collectionName.charAt(0);
|
||||
if (collectionStart.match("[a-zA-Z]") === null) {
|
||||
throw "Collection Name has to start with a letter";
|
||||
}
|
||||
if (modelName === collectionName) {
|
||||
if (modelBase === repositoryBase) {
|
||||
repositoryBase += "_repo";
|
||||
}
|
||||
modelName = collectionStart.toUpperCase() + modelBase;
|
||||
modelInstance = collectionStart.toLowerCase() + modelBase;
|
||||
repositoryName = collectionStart.toUpperCase() + repositoryBase;
|
||||
repositoryInstance = collectionStart.toLowerCase() + repositoryBase;
|
||||
repositoryPath = 'repositories/' + collectionName;
|
||||
|
@ -82,7 +86,8 @@
|
|||
repositoryInstance: repositoryName,
|
||||
repository: repositoryInstance,
|
||||
repositoryPath: repositoryPath,
|
||||
model: i.titleize(modelName),
|
||||
modelInstance: modelInstance,
|
||||
model: modelName,
|
||||
modelPath: modelPath,
|
||||
basePath: collectionName,
|
||||
collectionName: collectionName
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
* requestBody.
|
||||
*/
|
||||
controller.post('/<%= basePath %>', function (req, res) {
|
||||
var todo = req.params('todo');
|
||||
var <%= modelInstance %> = req.params('<%= modelInstance %>');
|
||||
res.json(<%= repositoryInstance %>.save(todo).forClient());
|
||||
}).bodyParam('todo', 'The <%= model %> you want to create', <%= model %>);
|
||||
}).bodyParam('<%= modelInstance %>', 'The <%= model %> you want to create', <%= model %>);
|
||||
|
||||
/** Updates a <%= model %>
|
||||
*
|
||||
|
@ -41,12 +41,12 @@
|
|||
*/
|
||||
controller.put('/<%= basePath %>/:id', function (req, res) {
|
||||
var id = req.params('id'),
|
||||
todo = req.params('todo');
|
||||
res.json(<%= repositoryInstance %>.replaceById(id, todo));
|
||||
<%= modelInstance %> = req.params('<%= modelInstance %>');
|
||||
res.json(<%= repositoryInstance %>.replaceById(id, <%= modelInstance %>));
|
||||
}).pathParam('id', {
|
||||
description: 'The id of the <%= model %>-Item',
|
||||
type: 'string'
|
||||
}).bodyParam('todo', 'The <%= model %> you want your old one to be replaced with', <%= model %>);
|
||||
}).bodyParam('<%= modelInstance %>', 'The <%= model %> you want your old one to be replaced with', <%= model %>);
|
||||
|
||||
/** Removes a <%= model %>
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue