Create Leaflet sidebar pane control with header writer fn
This commit is contained in:
parent
cd5b793dca
commit
8a02bd67d9
5 changed files with 30 additions and 42 deletions
23
app/assets/javascripts/leaflet.sidebar-pane.js
Normal file
23
app/assets/javascripts/leaflet.sidebar-pane.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
L.OSM.sidebarPane = function (options) {
|
||||
var control = L.control(options);
|
||||
|
||||
control.makeUI = function (uiClass, paneTitle, toggle) {
|
||||
var $ui = $("<div>")
|
||||
.attr("class", uiClass);
|
||||
|
||||
$("<div>")
|
||||
.attr("class", "sidebar_heading")
|
||||
.appendTo($ui)
|
||||
.append(
|
||||
$("<button type='button' class='btn-close float-end mt-1'>")
|
||||
.attr("aria-label", I18n.t("javascripts.close"))
|
||||
.bind("click", toggle))
|
||||
.append(
|
||||
$("<h4>")
|
||||
.text(I18n.t(paneTitle)));
|
||||
|
||||
return $ui;
|
||||
};
|
||||
|
||||
return control;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue