GitHub PullRequestReviewCommentEvent at 2014-02-26 00:17:30
Repository: finda
Actor: paulswartz
Payload: {"comment":{"url":"https://api.github.com/repos/codeforboston/finda/pulls/comments/10063241","id":10063241,"diff_hunk":"@@ -1,93 +1,87 @@\n 'use strict';\n define(\n   ['leaflet',\n+   'mapbox',\n    'jquery',\n    'flight'],\n   function(L, $, flight) {\n-    var map = function () {\n-      this.defaultAttrs({\n-        tileUrl: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',\n-        tileSubdomains: 'abc',\n-        tileAttribution: '&copy; <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors, ' + ' <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>'\n-\n+    var map = L.mapbox.map('map', 'examples.map-4l7djmvo');\n+\n+    map.defineIconStyles = function() {\n+      // define icon styles\n+      var path = L.Icon.Default.imagePath;\n+      if (!path) {\n+        path = L.Icon.Default.imagePath = 'lib/leaflet/images';\n+      }\n+      this.grayIcon = L.icon({\n+        iconUrl: path + '/marker-icon-gray.png'\n       });\n \n-      this.defineIconStyles = function() {\n-        // define icon styles\n-        var path = L.Icon.Default.imagePath;\n-        if (!path) {\n-          path = L.Icon.Default.imagePath = 'lib/leaflet/images';\n-        }\n-        this.grayIcon = L.icon({\n-          iconUrl: path + '/marker-icon-gray.png'\n-        });\n-\n-        this.defaultIcon = L.icon({\n-          iconUrl: path + '/marker-icon.png'\n-        });\n-      };\n-\n-      this.configureMap = function(ev, config) {\n-        var mapConfig = config.map;\n-        this.map.setView(mapConfig.center, mapConfig.zoom);\n-        if (mapConfig.maxZoom){\n-          this.map.options.maxZoom = mapConfig.maxZoom;\n-        }\n-        if (mapConfig.maxBounds){\n-          this.map.setMaxBounds(mapConfig.maxBounds);\n-        }\n-        // geolocate once the configuration is set\n-        this.map.locate({setView: true, maxZoom: mapConfig.zoom});\n-      };\n-\n-      this.loadData = function(ev, data) {\n-        this.defineIconStyles();\n-\n-        var setupFeature = function(feature, layer) {\n-          this.layers.push(layer);\n-          layer.on({click: this.emitClick.bind(this)});\n-        }.bind(this);\n-\n-        L.geoJson(data, {onEachFeature: setupFeature}).addTo(this.map);\n-      };\n-\n-      this.emitClick = function(e) {\n-        this.trigger(document, 'selectFeature', e.target.feature);\n-\n-        if (this.previouslyClicked) {\n-          this.previouslyClicked.setIcon(this.defaultIcon);\n-        }\n-\n-        e.target.setIcon(this.grayIcon);\n-        this.previouslyClicked = e.target;\n-      };\n-\n-      this.selectFeature = function(ev, feature) {\n-        this.trigger('panTo', {lng: feature.geometry.coordinates[0],\n-                               lat: feature.geometry.coordinates[1]});\n-      };\n-\n-      this.panTo = function(ev, latlng) {\n-        this.map.panTo(latlng);\n-      };\n-\n-      this.after('initialize', function() {\n-        this.map = L.map(this.node, {zoomControl: false});\n-\n-        this.layers = [];\n-\n-        L.tileLayer(this.attr.tileUrl, {\n-          attribution: this.attr.tileAttribution,\n-          subdomains: this.attr.tileSubdomains\n-        }).addTo(this.map);\n-\n-        this.on(document, 'config', this.configureMap);\n-        this.on(document, 'data', this.loadData);\n-\n-        this.on(document, 'selectFeature', this.selectFeature);\n-        this.on('panTo', this.panTo);\n+      this.defaultIcon = L.icon({\n+        iconUrl: path + '/marker-icon.png'\n       });\n     };\n \n+    map.configureMap = function(ev, config) {\n+      var mapConfig = config.map;\n+      this.map.setView(mapConfig.center, mapConfig.zoom);\n+      if (mapConfig.maxZoom){\n+        this.map.options.maxZoom = mapConfig.maxZoom;\n+      }\n+      if (mapConfig.maxBounds){\n+        this.map.setMaxBounds(mapConfig.maxBounds);\n+      }\n+      // geolocate once the configuration is set\n+      this.map.locate({setView: true, maxZoom: mapConfig.zoom});\n+    };\n+\n+    map.loadData = function(ev, data) {\n+      this.defineIconStyles();\n+\n+      var setupFeature = function(feature, layer) {\n+        this.layers.push(layer);\n+        layer.on({click: this.emitClick.bind(this)});\n+      }.bind(this);\n+\n+      L.geoJson(data, {onEachFeature: setupFeature}).addTo(this.map);\n+    };\n+\n+    map.emitClick = function(e) {\n+      this.trigger(document, 'selectFeature', e.target.feature);\n+\n+      if (this.previouslyClicked) {\n+        this.previouslyClicked.setIcon(this.defaultIcon);\n+      }\n+\n+      e.target.setIcon(this.grayIcon);\n+      this.previouslyClicked = e.target;\n+    };\n+\n+    map.selectFeature = function(ev, feature) {\n+      this.trigger('panTo', {lng: feature.geometry.coordinates[0],\n+                             lat: feature.geometry.coordinates[1]});\n+    };\n+\n+    map.panTo = function(ev, latlng) {\n+      this.map.panTo(latlng);\n+    };\n+\n+    map.after('initialize', function() {\n+      this.map = L.map(this.node, {zoomControl: false});","path":"src/map.js","position":150,"original_position":150,"commit_id":"bbd9b6a47db738a82597f3d5dedf58ea29d1bfc5","original_commit_id":"bbd9b6a47db738a82597f3d5dedf58ea29d1bfc5","user":{"login":"paulswartz","id":214921,"avatar_url":"https://gravatar.com/avatar/7cb174aac3d9e3cbc0ebb04868f710d6?d=https%3A%2F%2Fidenticons.github.com%2Fda5f79e75ec9cd53e7066baecaf94502.png&r=x","gravatar_id":"7cb174aac3d9e3cbc0ebb04868f710d6","url":"https://api.github.com/users/paulswartz","html_url":"https://github.com/paulswartz","followers_url":"https://api.github.com/users/paulswartz/followers","following_url":"https://api.github.com/users/paulswartz/following{/other_user}","gists_url":"https://api.github.com/users/paulswartz/gists{/gist_id}","starred_url":"https://api.github.com/users/paulswartz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulswartz/subscriptions","organizations_url":"https://api.github.com/users/paulswartz/orgs","repos_url":"https://api.github.com/users/paulswartz/repos","events_url":"https://api.github.com/users/paulswartz/events{/privacy}","received_events_url":"https://api.github.com/users/paulswartz/received_events","type":"User","site_admin":false},"body":"Here's where you can create the Leaflet map.  `this.node` is the DOM node that the map attaches to.","created_at":"2014-02-26T00:17:30Z","updated_at":"2014-02-26T00:17:30Z","html_url":"https://github.com/codeforboston/finda/pull/47#discussion_r10063241","pull_request_url":"https://api.github.com/repos/codeforboston/finda/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/codeforboston/finda/pulls/comments/10063241"},"html":{"href":"https://github.com/codeforboston/finda/pull/47#discussion_r10063241"},"pull_request":{"href":"https://api.github.com/repos/codeforboston/finda/pulls/47"}}}}