Merge map.js.erb and leaflet.extend.js.erb
authorJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 11 Nov 2013 18:04:10 +0000 (10:04 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 11 Nov 2013 22:42:46 +0000 (14:42 -0800)
app/assets/javascripts/application.js
app/assets/javascripts/index.js
app/assets/javascripts/leaflet.map.js.erb [moved from app/assets/javascripts/leaflet.extend.js.erb with 94% similarity]
app/assets/javascripts/map.js.erb [deleted file]

index 1cd6e224df3caca4edc27eee830063e3249c0e2c..f66f231efc3a7c008322a7d8a5045a0ab69c5afd 100644 (file)
 //= require leaflet
 //= require leaflet.osm
 //= require leaflet.hash
+//= require leaflet.map
 //= require leaflet.zoom
-//= require leaflet.extend
 //= require leaflet.locationfilter
 //= require i18n/translations
 //= require oauth
 //= require piwik
-//= require map
 //= require richtext
 //= require querystring
 
index 057fa13144526fa4f3f83a0017c4b733958cc8b4..e01ff3cb90008f61dcb37596750d1ddadd59d590 100644 (file)
@@ -16,7 +16,7 @@
 $(document).ready(function () {
   var params = OSM.mapParams();
 
-  var map = L.map("map", {
+  var map = new L.OSM.Map("map", {
     zoomControl: false,
     layerControl: false
   });
similarity index 94%
rename from app/assets/javascripts/leaflet.extend.js.erb
rename to app/assets/javascripts/leaflet.map.js.erb
index e0fb3c461bad4caf61c1dfe1d6e0346b3edc7543..606a713b7ffa896303f8b8337818786d5e07d93f 100644 (file)
@@ -9,7 +9,7 @@ L.extend(L.LatLngBounds.prototype, {
   }
 });
 
-L.extend(L.Map.prototype, {
+L.OSM.Map = L.Map.extend({
   getLayersCode: function () {
     var layerConfig = '';
     for (var i in this._layers) { // TODO: map.eachLayer
@@ -183,3 +183,14 @@ L.extend(L.Icon.Default.prototype, {
 
 L.Hash.prototype.parseHash = OSM.parseHash;
 L.Hash.prototype.formatHash = OSM.formatHash;
+
+function getUserIcon(url) {
+  return L.icon({
+    iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
+    iconSize: [25, 41],
+    iconAnchor: [12, 41],
+    popupAnchor: [1, -34],
+    shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
+    shadowSize: [41, 41]
+  });
+}
diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb
deleted file mode 100644 (file)
index 9829907..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-function getUserIcon(url) {
-  return L.icon({
-    iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
-    iconSize: [25, 41],
-    iconAnchor: [12, 41],
-    popupAnchor: [1, -34],
-    shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
-    shadowSize: [41, 41]
-  });
-}