]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.key.js
Create Leaflet sidebar pane control with header writer fn
[rails.git] / app / assets / javascripts / leaflet.key.js
index 367c39c1462067ab74ed7fdad466b0814a5b75fa..46c4661d2b0bd31e027a30a70348e2e798f195e4 100644 (file)
@@ -1,5 +1,5 @@
 L.OSM.key = function (options) {
-  var control = L.control(options);
+  var control = L.OSM.sidebarPane(options);
 
   control.onAdd = function (map) {
     var $container = $("<div>")
@@ -12,19 +12,7 @@ L.OSM.key = function (options) {
       .on("click", toggle)
       .appendTo($container);
 
-    var $ui = $("<div>")
-      .attr("class", "key-ui");
-
-    $("<div>")
-      .attr("class", "sidebar_heading")
-      .appendTo($ui)
-      .append(
-        $("<button type='button' class='btn-close float-end mt-1'>")
-          .attr("aria-label", I18n.t("javascripts.close"))
-          .bind("click", toggle))
-      .append(
-        $("<h4>")
-          .text(I18n.t("javascripts.key.title")));
+    var $ui = this.makeUI("key-ui", "javascripts.key.title", toggle);
 
     var $section = $("<div>")
       .attr("class", "section")