]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.layers.js
Create Leaflet sidebar pane control with header writer fn
[rails.git] / app / assets / javascripts / leaflet.layers.js
index 038205ca4975d16e593b89d4b0278fef61062367..518cdc7f173a96bb1d36bb2e8c993d925ffaf683 100644 (file)
@@ -1,5 +1,5 @@
 L.OSM.layers = function (options) {
-  var control = L.control(options);
+  var control = L.OSM.sidebarPane(options);
 
   control.onAdd = function (map) {
     var layers = options.layers;
@@ -15,19 +15,7 @@ L.OSM.layers = function (options) {
       .on("click", toggle)
       .appendTo($container);
 
-    var $ui = $("<div>")
-      .attr("class", "layers-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.map.layers.header")));
+    var $ui = this.makeUI("layers-ui", "javascripts.map.layers.header", toggle);
 
     var baseSection = $("<div>")
       .attr("class", "section base-layers")