X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8a02bd67d9d20c4a6b01b58e88b8d65163a3798e..c0278a01da05d8af7c4aec9eeab37a47f1d3110f:/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 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") + $("