]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/osrm.js
Moved inline styling to stylesheet
[rails.git] / app / assets / javascripts / index / directions / osrm.js
index 5c29f6c4d4a55cf758309860baccb2bd00e957d2..84f085c5a6c942cc16f0cc8fcb6344989d7ff2db 100644 (file)
@@ -111,21 +111,20 @@ function OSRMEngine() {
         }
 
         if (step.maneuver.type.match(/rotary|roundabout/)) {
-          instText += I18n.t(template + '_with_exit', { exit: step.maneuver.exit, name: name } );
-        } else if (step.maneuver.type.match(/on ramp|off ramp/)) {
-          if (step.destinations) {
-            if (namedRoad) {
-              instText += I18n.t(template + '_with_name_and_directions', { name: name, directions: destinations } );
-            } else {
-              instText += I18n.t(template + '_with_directions', { directions: destinations } );
-            }
+          if (step.maneuver.exit) {
+            instText += I18n.t(template + '_with_exit', { exit: step.maneuver.exit, name: name } );
           } else {
-            if (namedRoad) {
-              instText += I18n.t(template + '_without_exit', { name: name });
-            } else {
-              instText += I18n.t(template + '_without_directions');
-            }
+            instText += I18n.t(template + '_without_exit', { name: name } );
+          }
+        } else if (step.maneuver.type.match(/on ramp|off ramp/)) {
+          var params = {};
+          if (step.exits && step.maneuver.type.match(/off ramp/)) params.exit = step.exits;
+          if (step.destinations) params.directions = destinations;
+          if (namedRoad) params.directions = name;
+          if (Object.keys(params).length > 0) {
+            template = template + "_with_" + Object.keys(params).join("_");
           }
+          instText += I18n.t(template, params);
         } else {
           instText += I18n.t(template + '_without_exit', { name: name });
         }