From d797c850a8493c0027b1e8b8dbc4d3e78840d4d9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 19 Feb 2010 09:08:52 -0500 Subject: [PATCH] Moved the post_data() function in to its own static Javascript file. Added the route template (missing from a previous commit). --- www/maps/maps/public/javascripts/maputils.js | 17 +++++++++++++++++ .../maps/templates/javascript/routing.mako | 19 ------------------- www/maps/maps/templates/location/route.mako | 13 +++++++++++++ 3 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 www/maps/maps/public/javascripts/maputils.js create mode 100644 www/maps/maps/templates/location/route.mako diff --git a/www/maps/maps/public/javascripts/maputils.js b/www/maps/maps/public/javascripts/maputils.js new file mode 100644 index 0000000..45f976d --- /dev/null +++ b/www/maps/maps/public/javascripts/maputils.js @@ -0,0 +1,17 @@ +function post_data(url, data) { + /* Create a new form, and add it to the DOM. Then, create a hidden + input control as a child of the form which contains the data that + we'd like to post. Finally, add the form to the document's body, + and submit it. */ + var new_form = document.createElement("form"); + new_form.method = "post"; + new_form.action = url; + var new_input = document.createElement("input"); + new_input.setAttribute("id", "data"); + new_input.setAttribute("name", "data"); + new_input.setAttribute("type", "hidden"); + new_input.setAttribute("value", data); + new_form.appendChild(new_input); + document.body.appendChild(new_form); + new_form.submit(); +} diff --git a/www/maps/maps/templates/javascript/routing.mako b/www/maps/maps/templates/javascript/routing.mako index 94c280e..3d28f3b 100644 --- a/www/maps/maps/templates/javascript/routing.mako +++ b/www/maps/maps/templates/javascript/routing.mako @@ -1,22 +1,3 @@ -function post_data(url, data) { - /* Create a new form, and add it to the DOM. Then, create a hidden - input control as a child of the form which contains the data that - we'd like to post. Finally, add the form to the document's body, - and submit it. */ - var new_form = document.createElement("form"); - new_form.method = "post"; - new_form.action = url; - var new_input = document.createElement("input"); - new_input.setAttribute("id", "data"); - new_input.setAttribute("name", "data"); - new_input.setAttribute("type", "hidden"); - new_input.setAttribute("value", data); - new_form.appendChild(new_input); - document.body.appendChild(new_form); - new_form.submit(); -} - - var producers = new Array(); var consumers = new Array(); diff --git a/www/maps/maps/templates/location/route.mako b/www/maps/maps/templates/location/route.mako new file mode 100644 index 0000000..9ec8279 --- /dev/null +++ b/www/maps/maps/templates/location/route.mako @@ -0,0 +1,13 @@ +<%inherit file="/base.mako"/>\ + +<%def name="scripts()"> + + + + + + \ No newline at end of file -- 2.43.2