/* Javascript wrapper around {{ module_name }} */ {% if module_documenation %} //Module documentation: /* {{ module_documenation }} */ {% else %} /* This module has no documentation. */ {% endif %} window.adagios = window.adagios || {}; // a convenience function for parsing string namespaces and // automatically generating nested namespaces function extend( ns, ns_string ) { var parts = ns_string.split('.'), parent = ns, pl, i; if (parts[0] == "myApp") { parts = parts.slice(1); } pl = parts.length; for (i = 0; i < pl; i++) { //create a property if it doesnt exist if (typeof parent[parts[i]] == 'undefined') { parent[parts[i]] = {}; } parent = parent[parts[i]]; } return parent; } var mod = extend(window, 'adagios.rest.{{ module_name }}'); {% for i,v in functions.items %} /* Function {{ i }}() ############################################################################### {% autoescape off %}{{ v.docstring }}{% endautoescape %} Valid parameters: {{ v.argstring }} */ adagios.rest.{{ module_name }}.{{ i }} = function(parameters) { // Return jquery promise object for ajax: return $.ajax({ type: 'POST', url: '{{ v.url }}', data: parameters, async: true, contentType: "application/json", dataType: 'json' }); }; /* end of function {{ i }}() */ {% endfor %}