From 5962141114c890b528e464af9ce9cbefde81917c Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Tue, 20 Jan 2015 17:45:47 +0100 Subject: [PATCH] Moves template options to controller --- lib/cartodb/cartodb_windshaft.js | 5 ----- lib/cartodb/controllers/template_maps.js | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index ec55fb8c..e3e12c26 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -227,11 +227,6 @@ var CartodbWindshaft = function(serverOptions) { ); }; - ws.options(template_baseurl + '/:template_id', function(req, res) { - ws.doCORS(res, "Content-Type"); - return next(); - }); - // Instantiate a template function instanciateTemplate(req, res, template_params, callback) { ws.doCORS(res); diff --git a/lib/cartodb/controllers/template_maps.js b/lib/cartodb/controllers/template_maps.js index 67090c3e..3c903fcd 100644 --- a/lib/cartodb/controllers/template_maps.js +++ b/lib/cartodb/controllers/template_maps.js @@ -20,6 +20,7 @@ TemplateMapsController.prototype.register = function(app) { app.get(this.templateBaseUrl + '/:template_id', this.retrieve.bind(this)); app.del(this.templateBaseUrl + '/:template_id', this.destroy.bind(this)); app.get(this.templateBaseUrl, this.list.bind(this)); + app.options(this.templateBaseUrl + '/:template_id', this.options.bind(this)); }; // Add a template @@ -288,6 +289,11 @@ TemplateMapsController.prototype.list = function(req, res) { ); }; +TemplateMapsController.prototype.options = function(req, res) { + this.app.doCORS(res, "Content-Type"); + return next(); +}; + /** * jsonp endpoint, allows to instantiate a template with a json call. * callback query argument is mandatory