]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.sidebar-pane.js
Create pane button fn
[rails.git] / app / assets / javascripts / leaflet.sidebar-pane.js
index f087cbb4a5845b30123f9fb8706cfa522a63d9f1..fff0b40631931b93f023f162a04e4b2548c2c17e 100644 (file)
@@ -1,6 +1,20 @@
 L.OSM.sidebarPane = function (options) {
   var control = L.control(options);
 
+  control.makeButton = function (buttonClass, buttonTitle, toggle) {
+    var button =  $("<a>")
+      .attr("class", "control-button")
+      .attr("href", "#")
+      .html("<span class=\"icon " + buttonClass + "\"></span>")
+      .on("click", toggle);
+    
+    if (buttonTitle) {
+      button.attr("title", I18n.t(buttonTitle))
+    }
+
+    return button;
+  };
+
   control.makeUI = function (uiClass, paneTitle, toggle) {
     var $ui = $("<div>")
       .attr("class", uiClass);