]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.key.js
Create pane button fn
[rails.git] / app / assets / javascripts / leaflet.key.js
index e170ff35227d49b478d6674c87f73dea4c421b50..238d70c5f25c08c71688a9e9c851ba338268d9be 100644 (file)
@@ -1,31 +1,14 @@
 L.OSM.key = function (options) {
-  var control = L.control(options);
+  var control = L.OSM.sidebarPane(options);
 
   control.onAdd = function (map) {
     var $container = $("<div>")
       .attr("class", "control-key");
 
-    var button = $("<a>")
-      .attr("class", "control-button")
-      .attr("href", "#")
-      .html("<span class=\"icon key\"></span>")
-      .on("click", toggle)
+    var button = this.makeButton("key", null, toggle)
       .appendTo($container);
 
-    var $ui = $("<div>")
-      .attr("class", "key-ui");
-
-    $("<div>")
-      .attr("class", "sidebar_heading")
-      .appendTo($ui)
-      .append(
-        $("<span>")
-          .text(I18n.t("javascripts.close"))
-          .attr("class", "icon 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")