]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.html.erb
Don't require a second click to create an OpenStreetBug
[rails.git] / app / views / site / index.html.erb
index 633a7ba3b0c9ee1edbdf7e2408c58af6ef03ea6e..681924444a7fefaf5aaa6d830fb00c5292b3008c 100644 (file)
@@ -25,7 +25,7 @@
 <div id="permalink">
   <a href="/" id="permalinkanchor"><%= t 'site.index.permalink' %></a><br/>
   <a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a><br/>
-  <a href="javascript:void()" id="ReportBug">Report a problem</a>      
+  <a href="javascript:void();" id="ReportBug" class="reportProblem">Report a problem</a>       
 </div>
 
 <div id="attribution">
@@ -129,10 +129,9 @@ end
 
   OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
 
-  function createBugCallBack() {
-       map.osbControl.deactivate();
-       document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "default";
-  }
+  <% if @user %>
+    var loginName = "<%= @user.display_name %>"
+  <% end %>
 
   function mapInit(){
     map = createMap("map");
@@ -151,7 +150,8 @@ end
           cookieLifetime : 1000, 
           cookiePath : "/my/map/", 
           permalinkURL : "http://www.openstreetmap.org/", 
-          theme : "/stylesheets/openstreetbugs.css" 
+          theme : "/stylesheets/openstreetbugs.css",
+          visibility : false 
       });
 
       map.addLayer(map.osbLayer);
@@ -161,8 +161,13 @@ end
       map.addControl(map.osbControl);
                
          var lBug = document.getElementById('ReportBug');
+     /* lBug.addEventListener('click',function (e) {
+               map.osbControl.activate(); document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "crosshair" },false); */
       lBug.addEventListener('click',function (e) {
-               map.osbControl.activate(); document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "crosshair" },false);
+               map.osbControl.activate(); map.osbControl.addTemporaryMarker(map.getCenter());},false);
+
+     map.events.register("zoomend",map,function () { var zoom = map.getZoom(); var lBug = document.getElementById('ReportBug')
+        if (zoom > 11) { lBug.style.visibility = 'visible';} else {lBug.style.visibility = "hidden";}});
 
 
     <% end %>