From 4b5dcd054e13667a3a456a75a722087791fcd6fc Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 6 Feb 2013 17:34:41 -0500 Subject: [PATCH] Fix sourcetag regression --- css/app.css | 1 - js/id/ui.js | 5 +++-- js/id/ui/layerswitcher.js | 24 ++++++++++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/css/app.css b/css/app.css index ef42bb28c..65f98dfd6 100644 --- a/css/app.css +++ b/css/app.css @@ -93,7 +93,6 @@ a:hover { color:#597be7; } - textarea, input[type=text] { background-color: white; diff --git a/js/id/ui.js b/js/id/ui.js index ace66703d..747bccb70 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -161,8 +161,9 @@ iD.ui = function(context) { var imagery = linkList.append('li').attr('id', 'attribution'); imagery.append('span').text('imagery'); - imagery.append('a').attr('target', '_blank') - .attr('href', 'http://opengeodata.org/microsoft-imagery-details').text(' provided by bing'); + imagery + .append('span') + .attr('class', 'provided-by'); linkList.append('li').attr('class', 'source-switch').append('a').attr('href', '#') .text('dev') diff --git a/js/id/ui/layerswitcher.js b/js/id/ui/layerswitcher.js index f788322b1..b73ede9d3 100644 --- a/js/id/ui/layerswitcher.js +++ b/js/id/ui/layerswitcher.js @@ -38,7 +38,7 @@ iD.ui.layerswitcher = function(context) { selection.on('click.layerswitcher-inside', function() { return d3.event.stopPropagation(); }); - d3.select('body').on('click.layerswitcher-outside', hide); + context.container().on('click.layerswitcher-outside', hide); } var opa = content @@ -76,16 +76,28 @@ iD.ui.layerswitcher = function(context) { .style('opacity', String); // Make sure there is an active selection by default - d3.select('.opacity-options li:nth-child(2)').classed('selected', true); + opa.select('.opacity-options li:nth-child(2)').classed('selected', true); function selectLayer(d) { + content.selectAll('a.layer') .classed('selected', function(d) { return d === context.background().source(); }); - d3.select('#attribution a') - .attr('href', d.data.link) - .text('provided by ' + d.data.name); + + var provided_by = context.container().select('#attribution .provided-by') + .html(''); + + if (d.data.terms_url) { + provided_by.append('a') + .attr('href', (d.data.terms_url || '')) + .classed('disabled', !d.data.terms_url) + .text(' provided by ' + (d.data.sourcetag || d.data.name)); + } else { + provided_by + .text(' provided by ' + (d.data.sourcetag || d.data.name)); + } + } function clickSetSource(d) { @@ -96,7 +108,7 @@ iD.ui.layerswitcher = function(context) { d = configured; } context.background().source(d); - context.history().imagery_used(d.name); + context.history().imagery_used(d.data.sourcetag || d.data.name); context.redraw(); selectLayer(d); }