X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8a02bd67d9d20c4a6b01b58e88b8d65163a3798e..4d4b79800ac2b4ea282a74a9660c11d2748ee5c2:/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..516a446c3 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") + $("
") .appendTo($ui) - .append( - $("