From 15c156483263893d2c767030bd544d589833af93 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Tue, 21 Jan 2014 21:44:09 +0000 Subject: [PATCH] Start to make turn-by-turn instructions clickable --- app/assets/javascripts/routing.js.erb | 21 ++++++++++++++------- app/assets/stylesheets/common.css.scss | 6 ++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb index ed9551252..f496262d2 100644 --- a/app/assets/javascripts/routing.js.erb +++ b/app/assets/javascripts/routing.js.erb @@ -95,10 +95,13 @@ OSM.Routing=function(map,name,jqSearch) { // (we use OSRM's route_instructions format) // *** translations? r.setItinerary=function(steps) { + // Create base table $("#content").removeClass("overlay-sidebar"); $('#sidebar_content').empty(); var html='

Directions

'.replace(/~/g,"'"); - html+=""; + html+="
"; + $('#sidebar_content').html(html); + // Add each row for (var i=0; i "; - html+=""); + row.append("
"+instText; - html+=""+dist; + var row=$("
"); + row.append(""+instText); + row.append(""+dist); + with ({n: i}) { row.on('click',function(e) { r.clickTurn(n); }); + } + $('#turnbyturn').append(row); } - html+="
"; - $('#sidebar_content').html(html); + }; + r.clickTurn=function(num) { + console.log("clicked turn",num); }; diff --git a/app/assets/stylesheets/common.css.scss b/app/assets/stylesheets/common.css.scss index 6e402f3b8..d0732de74 100644 --- a/app/assets/stylesheets/common.css.scss +++ b/app/assets/stylesheets/common.css.scss @@ -1018,6 +1018,12 @@ td.distance { text-align: right; font-size: x-small; } +tr.turn { + cursor: pointer; +} +tr.turn:hover { + background: lighten($green, 30%); +} /* Rules for entity history */ -- 2.43.2