X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/001ff5764bcf15aaa179dc5c7844038676536622..e3b8b8933044104bb515d34c3d36851caba78ac7:/app/views/site/index.html.erb
diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb
index 70402a1c9..a61baca81 100644
--- a/app/views/site/index.html.erb
+++ b/app/views/site/index.html.erb
@@ -25,7 +25,7 @@
@@ -114,9 +114,7 @@ else
end
%>
-
-
-
+<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
<%= javascript_include_tag 'openstreetbugs.js' %>
<%= javascript_include_tag 'map.js' %>
@@ -129,10 +127,9 @@ end
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
- function createBugCallBack() {
- map.osbControl.deactivate();
- document.getElementById("map_OpenLayers_Container").style.cursor = "default";
- }
+ <% if @user %>
+ var loginName = "<%= @user.display_name %>"
+ <% end %>
function mapInit(){
map = createMap("map");
@@ -142,28 +139,24 @@ end
map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData);
map.addLayer(map.dataLayer);
- map.osbLayer = new OpenLayers.Layer.OpenStreetBugs("OpenStreetBugs", {
- serverURL : "/api/0.6/",
- iconOpen : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/open_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
- iconClosed : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
- readonly : false,
- setCookie : false,
- cookieLifetime : 1000,
- cookiePath : "/my/map/",
- permalinkURL : "http://www.openstreetmap.org/",
- theme : "http://osm.cdauth.de/map/openstreetbugs.css"
+ map.osbLayer = new OpenLayers.Layer.OpenStreetBugs("Notes", {
+ serverURL: "/api/0.6/",
+ iconOpen: new OpenLayers.Icon("<%= image_path "open_note_marker.png" %>", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
+ iconClosed: new OpenLayers.Icon("<%= image_path "closed_noe_marker.png" %>", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
+ readonly: false,
+ setCookie: false,
+ permalinkURL: "http://www.openstreetmap.org/",
+ theme: "<%= stylesheet_path "openstreetbugs" %>",
+ visibility: false
});
-
map.addLayer(map.osbLayer);
map.osbControl = new OpenLayers.Control.OpenStreetBugs(map.osbLayer);
map.addControl(map.osbControl);
-
- var lBug = document.getElementById('ReportBug');
- lBug.addEventListener('click',function (e) {
- map.osbControl.activate(); document.getElementById("map_OpenLayers_Container").style.cursor = "crosshair"; if (e.stopPropagation) e.stopPropagation(); },false);
+ $("reportbuganchor").observe("click", addBug);
+ map.events.register("zoomend", map, allowBugReports);
<% end %>
<% unless object_zoom %>
@@ -327,6 +320,19 @@ end
<% end %>
}
+ function addBug() {
+ map.osbControl.activate();
+ map.osbControl.addTemporaryMarker(map.getCenter());
+ }
+
+ function allowBugReports() {
+ if (map.getZoom() > 11) {
+ $("reportbuganchor").style.visibility = "visible";
+ } else {
+ $("reportbuganchor").style.visibility = "hidden";
+ }
+ }
+
mapInit();
Event.observe(window, "load", installEditHandler);