]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_potlatch2.html.erb
Fix URL updating in Potlatch 1
[rails.git] / app / views / site / _potlatch2.html.erb
index 65ca9210e11734d4209c9d4fe9b12158102bf366..2f8e10a5bea1c096619d73324887230f6e0d2eab 100644 (file)
@@ -10,7 +10,7 @@
 <script type="text/javascript">alert("<%= t 'site.edit.potlatch2_not_configured' %>")</script>
 <% end %>
 
-<% locale = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>
+<% locale = select_locale(Potlatch2::LOCALES.keys).to_s %>
 
 <script type="text/javascript" defer="defer">
   var changesaved=true;
@@ -32,6 +32,8 @@
     flashvars.font_library = "<%= asset_path "potlatch2/FontLibrary.swf" %>";
     flashvars.locale = "<%= Potlatch2::LOCALES[locale] %>";
     flashvars.locale_paths = "<%= Potlatch2::LOCALES[locale] %>=<%= asset_path("potlatch2/locales/#{Potlatch2::LOCALES[locale]}.swf") %>";
+    flashvars.intro_image = "<%= asset_path "help/introduction.jpg" %>";
+    flashvars.intro_video = "<%= asset_path "help/introduction.mp4" %>";
     <% if params['gpx'] %>
     flashvars.gpx = '<%= h(params['gpx']) %>';
     <% end %>
 
     swfobject.embedSWF("<%= asset_path("potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.102","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
     // 700,600 for fixed size, 100%,100% for resizable
+
+    if (lat && lon) {
+      updateLinks({ lon: lon, lat: lat }, zoom);
+    }
   }
 
   <% if @lat && @lon -%>
     });
   });
 
-  function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
-    updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);
-  }
+  var mapMoved = $.throttle(250, function(lon, lat, zoom) {
+    updateLinks({ lon: lon, lat: lat }, zoom);
+
+    var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
+    if (hash !== location.hash) {
+      location.replace(hash);
+    }
+  });
 </script>