X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/71e7208a0aceccf47edce739803130096999da5d..c162a9660e66e2a414c922cf5ec9efa318f86b0e:/app/assets/javascripts/leaflet.sidebar-pane.js?ds=sidebyside diff --git a/app/assets/javascripts/leaflet.sidebar-pane.js b/app/assets/javascripts/leaflet.sidebar-pane.js index fff0b4063..5e5006fb0 100644 --- a/app/assets/javascripts/leaflet.sidebar-pane.js +++ b/app/assets/javascripts/leaflet.sidebar-pane.js @@ -1,37 +1,52 @@ -L.OSM.sidebarPane = function (options) { +L.OSM.sidebarPane = function (options, uiClass, buttonTitle, paneTitle) { var control = L.control(options); - control.makeButton = function (buttonClass, buttonTitle, toggle) { - var button = $("") + control.onAdd = function (map) { + var $container = $("
") + .attr("class", "control-" + uiClass); + + var button = $("") .attr("class", "control-button") .attr("href", "#") - .html("") + .html("") .on("click", toggle); - + if (buttonTitle) { - button.attr("title", I18n.t(buttonTitle)) + button.attr("title", I18n.t(buttonTitle)); } - return button; - }; + button.appendTo($container); - control.makeUI = function (uiClass, paneTitle, toggle) { var $ui = $("
") - .attr("class", uiClass); + .attr("class", uiClass + "-ui"); - $("
") - .attr("class", "sidebar_heading") + $("
") .appendTo($ui) - .append( - $("