From: Tom Hughes Date: Wed, 16 Apr 2008 23:45:16 +0000 (+0000) Subject: Ajaxify the export tab. X-Git-Tag: live~8443^2~16 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/599c48227a94339f7e58bddc3fb0d0215baa58c4 Ajaxify the export tab. --- diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index a5766e99c..b1d992e6d 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -3,7 +3,6 @@ class ExportController < ApplicationController render :update do |page| page.replace_html :sidebar_title, 'Export' page.replace_html :sidebar_content, :partial => 'start' - page.call "openSidebar" end end diff --git a/app/views/export/_start.rhtml b/app/views/export/_start.rhtml index 749928c12..11fc61809 100644 --- a/app/views/export/_start.rhtml +++ b/app/views/export/_start.rhtml @@ -60,10 +60,11 @@ diff --git a/public/javascripts/map.js b/public/javascripts/map.js index 07c6b32d1..9858d4576 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -124,12 +124,15 @@ function getMapLayers() { function setMapLayers(layers) { for (var i=0; i < layers.length; i++) { var layer = map.layers[i]; - var c = layers.charAt(i); - if (c == "B") { - map.setBaseLayer(layer); - } else if ( (c == "T") || (c == "F") ) { - layer.setVisibility(c == "T"); + if (layer) { + var c = layers.charAt(i); + + if (c == "B") { + map.setBaseLayer(layer); + } else if ( (c == "T") || (c == "F") ) { + layer.setVisibility(c == "T"); + } } } } diff --git a/public/javascripts/site.js b/public/javascripts/site.js index 6fb68e65a..a7651fa45 100644 --- a/public/javascripts/site.js +++ b/public/javascripts/site.js @@ -29,6 +29,18 @@ function updatelinks(lon,lat,zoom,layers) { node.href = setArgs(node.href, args); } + node = document.getElementById("exportanchor"); + if (node) { + var args = getArgs(node.href); + args["lat"] = lat; + args["lon"] = lon; + args["zoom"] = zoom; + if (layers) { + args["layers"] = layers; + } + node.href = setArgs(node.href, args); + } + node = document.getElementById("editanchor"); if (node) { if (zoom >= 11) {