Merge pull request #11 from danstowell/jsrouting-pulldownchange
authorRichard Fairhurst <richard@systemeD.net>
Fri, 7 Mar 2014 15:58:04 +0000 (15:58 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Fri, 7 Mar 2014 15:58:04 +0000 (15:58 +0000)
refresh search if showing and user changes provider

1  2 
app/assets/javascripts/routing.js.erb

index 6a8961a7c8bac62c0212d4449f2b49d2601a2459,4ea30fa000759677b03f8c20c1757e62d9af54f4..fbec3e7e3ada6e072eea4fd87ffdd670782dd837
@@@ -211,8 -211,6 +211,8 @@@ OSM.Routing=function(map,name,jqSearch
                        $('#turnbyturn').append(row);
                        cumulative+=step[3];
                }
 +              $('#sidebar_content').append('<p id="routing_credit">' + r.chosenEngine.creditline + '</p>');
 +
        };
        r.clickTurn=function(num,latlng) {
                r.popup=L.popup().setLatLng(latlng).setContent("<p>"+(num+1)+"</p>").openOn(r.map);
        // Choose an engine on dropdown change
        r.selectEngine=function(e) {
                r.chosenEngine=r.engines[e.target.selectedIndex];
+               if (r.polyline){ // and if a route is currently showing, must also refresh, else confusion
+                       r.requestRoute(true);
+               }
        };
        // Choose an engine by name
        r.chooseEngine=function(name) {