Hide route steps sidebar when user presses close button.
authorMatt Amos <zerebubuth@gmail.com>
Mon, 26 Jan 2015 15:39:53 +0000 (15:39 +0000)
committerMatt Amos <zerebubuth@gmail.com>
Mon, 26 Jan 2015 15:39:53 +0000 (15:39 +0000)
app/assets/javascripts/index/directions.js.erb

index ee2cce667c113d5f4aa2372957205af56bfa4c33..3e2251b7ae8929d5c970353f4e61a3b48d68123a 100644 (file)
@@ -253,6 +253,14 @@ OSM.Directions = function (map) {
       $('#sidebar_content').append('<p id="routing_credit">' +
         I18n.t('javascripts.directions.instructions.courtesy', {link: chosenEngine.creditline}) +
         '</p>');
+
+      $('#sidebar_content a.geolink').on('click', function(e) {
+        e.preventDefault();
+        map.removeLayer(polyline);
+        $('#sidebar_content').html('');
+        map.setSidebarOverlaid(true);
+        // TODO: collapse width of sidebar back to previous
+      });
     });
   }