X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/8a02bd67d9d20c4a6b01b58e88b8d65163a3798e..2e34b62fac7d0a9a7b03e92bdf26f691736e2954:/app/assets/javascripts/leaflet.sidebar-pane.js diff --git a/app/assets/javascripts/leaflet.sidebar-pane.js b/app/assets/javascripts/leaflet.sidebar-pane.js index f087cbb4a..d8213a376 100644 --- a/app/assets/javascripts/leaflet.sidebar-pane.js +++ b/app/assets/javascripts/leaflet.sidebar-pane.js @@ -1,23 +1,52 @@ -L.OSM.sidebarPane = function (options) { +L.OSM.sidebarPane = function (options, uiClass, buttonTitle, paneTitle) { var control = L.control(options); - control.makeUI = function (uiClass, paneTitle, toggle) { + control.onAdd = function (map) { + var $container = $("
") + .attr("class", "control-" + uiClass); + + var button = $("") + .attr("class", "control-button") + .attr("href", "#") + .html("") + .on("click", toggle); + + if (buttonTitle) { + button.attr("title", I18n.t(buttonTitle)); + } + + button.appendTo($container); + var $ui = $("
") - .attr("class", uiClass); + .attr("class", uiClass + "-ui"); - $("
") - .attr("class", "sidebar_heading") + $("