From ded28617c73090028c416e46ade69f7584536548 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 13 Jun 2013 13:21:24 -0400 Subject: [PATCH] Add clearer close action, refactor base layer code --- app/assets/javascripts/application.js | 7 ++++--- app/assets/javascripts/index/export.js | 4 ++-- app/assets/javascripts/leaflet.key.js | 8 +++++++- app/assets/javascripts/leaflet.layers.js | 6 ++++++ app/assets/javascripts/leaflet.share.js | 6 ++++++ app/assets/stylesheets/common.css.scss | 11 ++++++++++- 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fc426e883..f5022683b 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -126,13 +126,14 @@ function getShortUrl(map) { function getUrl(map) { var center = map.getCenter(), - zoom = map.getZoom(); + zoom = map.getZoom(), + toZoom = zoomPrecision(zoom); return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ? 'http://openstreetmap.org/?' : '/?') + querystring.stringify({ - lat: center.lat, - lon: center.lng, + lat: toZoom(center.lat), + lon: toZoom(center.lng), zoom: zoom, layers: map.getLayersCode() }); diff --git a/app/assets/javascripts/index/export.js b/app/assets/javascripts/index/export.js index 2baab4d4b..1f624f125 100644 --- a/app/assets/javascripts/index/export.js +++ b/app/assets/javascripts/index/export.js @@ -38,7 +38,7 @@ function initializeExport(map) { openSidebar(); - if (getMapBaseLayerId(map) == "mapnik") { + if (map.getMapBaseLayerId() == "mapnik") { $("#format_mapnik").prop("checked", true); } @@ -186,7 +186,7 @@ function initializeExport(map) { function htmlUrlChanged() { var bounds = getBounds(); - var layerName = getMapBaseLayerId(map); + var layerName = map.getMapBaseLayerId(); var url = "http://" + OSM.SERVER_URL + "/export/embed.html?bbox=" + bounds.toBBoxString() + "&layer=" + layerName; var markerUrl = ""; diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js index cf54b2ded..5aae3d1c2 100644 --- a/app/assets/javascripts/leaflet.key.js +++ b/app/assets/javascripts/leaflet.key.js @@ -18,6 +18,12 @@ L.OSM.key = function (options) { $('
') .appendTo($ui) + .append( + $('') + .html('»') + .attr('class', 'close-button') + .attr('href', '#') + .bind('click', toggle)) .append( $('

') .text(I18n.t('javascripts.key.title'))); @@ -47,7 +53,7 @@ L.OSM.key = function (options) { } function update() { - var layer = getMapBaseLayerId(map), + var layer = map.getMapBaseLayerId(), zoom = map.getZoom(); $('.mapkey-table-entry').each(function () { diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 80613a5d9..57cd53d4d 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -20,6 +20,12 @@ L.OSM.layers = function(options) { $('
') .appendTo($ui) + .append( + $('') + .html('»') + .attr('class', 'close-button') + .attr('href', '#') + .bind('click', toggle)) .append( $('

') .text(I18n.t('javascripts.map.layers.header'))); diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 773145bed..664aebaa5 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -18,6 +18,12 @@ L.OSM.share = function (options) { $('
') .appendTo($ui) + .append( + $('') + .html('»') + .attr('class', 'close-button') + .attr('href', '#') + .bind('click', toggle)) .append( $('

') .text(I18n.t('javascripts.share.title'))); diff --git a/app/assets/stylesheets/common.css.scss b/app/assets/stylesheets/common.css.scss index 4ce15ec45..dba6205fb 100644 --- a/app/assets/stylesheets/common.css.scss +++ b/app/assets/stylesheets/common.css.scss @@ -604,6 +604,15 @@ a.donate { margin:0; } + a.close-button { + float: right; + padding:5px; + font-size:20px; + line-height:15px; + color:#222; + border:1px solid #ddd; + } + li { border-radius: 4px; overflow: hidden; @@ -1268,7 +1277,7 @@ ul.results-list li { border-bottom: 1px solid #ccc; } } h1, h2 { font-size: 21px; - line-height: 1; + line-height: 1em; } small.deemphasize { float: left; -- 2.39.5