From eb35b6b8d8248a0e4eea1f134def3d439e93493a Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Wed, 28 May 2025 23:52:00 +0200 Subject: [PATCH] Write layer sidebar in erb template --- app/abilities/ability.rb | 2 +- app/assets/javascripts/leaflet.layers.js | 93 ++++++---------------- app/controllers/layers_panes_controller.rb | 9 +++ app/views/layers_panes/show.html.erb | 30 +++++++ config/routes.rb | 1 + 5 files changed, 67 insertions(+), 68 deletions(-) create mode 100644 app/controllers/layers_panes_controller.rb create mode 100644 app/views/layers_panes/show.html.erb diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index f68449aa8..18f8ad93a 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -4,7 +4,7 @@ class Ability include CanCan::Ability def initialize(user) - can :read, [:feature_query, :legend_pane] + can :read, [:feature_query, :layers_pane, :legend_pane] can :read, [Node, Way, Relation, OldNode, OldWay, OldRelation] can [:show, :create], Note can :read, :directions diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 82f477973..cbd704fe5 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -4,31 +4,19 @@ L.OSM.layers = function (options) { control.onAddPane = function (map, button, $ui, toggle) { const layers = options.layers; - const baseSection = $("
") - .text(OSM.i18n.t("javascripts.map.layers.overlays")) - .attr("class", "text-body-secondary small mb-2") - .appendTo(overlaySection); - - const addOverlay = function (layer, name, maxArea) { - const item = $("
<%= t "javascripts.map.layers.overlays" %>