1
0
Fork 0

added transformation

This commit is contained in:
Frank Celler 2013-08-07 11:31:05 +02:00
parent ca15e530c0
commit 8ed7a0115b
5 changed files with 14 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>Swagger UI</title>
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<!-- NO EXTERNAL LINKS link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/ -->
<link href='css/swagger/hightlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/swagger/screen.css' media='screen' rel='stylesheet' type='text/css'/>
<script src='js/lib/jquery-1.8.0.min.js' type='text/javascript'></script>

View File

@ -8,7 +8,7 @@
<meta name="description" content="ArangoDB Admin Web Interface">
<meta name="author" content="Heiko Kernbach">
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<!-- NO EXTERNAL LINKS! link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'-->
<link href="css/style.css" rel="stylesheet">

View File

@ -1148,9 +1148,11 @@ function require (path) {
/// @brief loadAppScript
////////////////////////////////////////////////////////////////////////////////
ArangoApp.prototype.loadAppScript = function (appModule, file, appContext, context) {
ArangoApp.prototype.loadAppScript = function (appModule, file, appContext, options) {
'use strict';
options = options || {};
var fileContent;
var full;
var key;
@ -1158,6 +1160,10 @@ function require (path) {
try {
full = fs.join(this._root, this._path, file);
fileContent = fs.read(full);
if (options.hasOwnProperty('transform')) {
fileContent = options.transform(fileContent);
}
}
catch (err1) {
throw "cannot read file '" + full + "': " + err1 + " - " + err1.stack;
@ -1165,7 +1171,9 @@ function require (path) {
var sandbox = {};
if (context !== undefined) {
if (options.hasOwnProperty('context')) {
var context = options.context;
for (key in context) {
if (context.hasOwnProperty(key) && key !== "__myenv__") {
sandbox[key] = context[key];

View File

@ -35,6 +35,7 @@ var fs = require("fs");
var executeGlobalContextFunction = require("internal").executeGlobalContextFunction;
var checkParameter = arangodb.checkParameter;
var transformScript = require("org/arangodb/foxx/transformer").transform;
// -----------------------------------------------------------------------------
// --SECTION-- private functions
@ -517,7 +518,7 @@ function routingAalApp (app, mount, options) {
extendContext(context, app, root);
app.loadAppScript(context.appModule, file, context);
app.loadAppScript(context.appModule, file, context, { transform: transformScript });
// .............................................................................
// routingInfo