From: John Firebaugh Date: Thu, 30 Aug 2012 16:00:55 +0000 (-0700) Subject: Extract layer configuration to map.js X-Git-Tag: live~5364 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/3b1f455dd9c7b64933f952350081728458d190a1?hp=5f0c590c32565ffb807699df02c7ce8392513210 Extract layer configuration to map.js --- diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index c97dc76c3..8aa9868b3 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -71,6 +71,12 @@ function createMap(divName, options) { }); map.addLayer(markers); + map.dataLayer = new OpenLayers.Layer(I18n.t('browse.start_rjs.data_layer_name'), { + visibility: false, + displayInLayerSwitcher: false + }); + map.addLayer(map.dataLayer); + $("#" + divName).on("resized", function () { map.updateSize(); }); diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index 3e4c4d996..25f0c8585 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -128,14 +128,6 @@ end function mapInit(){ map = createMap("map"); - <% unless STATUS == :api_offline or STATUS == :database_offline %> - map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", { - visibility: false, - displayInLayerSwitcher: false - }); - map.addLayer(map.dataLayer); - <% end %> - <% unless object_zoom %> <% if bbox %> var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);