]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.key.js
Add clearer close action, refactor base layer code
[rails.git] / app / assets / javascripts / leaflet.key.js
index 9fe457851f35dad9ed907a36a1fe65bb44875e19..5aae3d1c25c1efe53b03793ed78abc8a3d561cab 100644 (file)
@@ -16,9 +16,17 @@ L.OSM.key = function (options) {
     var $ui = $('<div>')
       .attr('class', 'layers-ui');
 
-    $('<h2>')
-      .text(I18n.t('javascripts.key.title'))
-      .appendTo($ui);
+    $('<section>')
+      .appendTo($ui)
+      .append(
+          $('<a>')
+            .html('&raquo;')
+            .attr('class', 'close-button')
+            .attr('href', '#')
+            .bind('click', toggle))
+      .append(
+      $('<h2>')
+        .text(I18n.t('javascripts.key.title')));
 
     var $section = $('<section>')
       .appendTo($ui);
@@ -45,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 () {