From f5dfd5e6bb26e4f4d4566a7262055ce7da1e348e Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Tue, 17 Jun 2025 06:57:32 +0200 Subject: [PATCH] Move /key to /panes/legend --- app/assets/javascripts/leaflet.legend.js | 2 +- app/assets/javascripts/leaflet.sidebar-pane.js | 2 +- config/routes.rb | 2 +- test/controllers/legend_panes_controller_test.rb | 2 +- test/system/site_test.rb | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/leaflet.legend.js b/app/assets/javascripts/leaflet.legend.js index c4f208543..3f5a72850 100644 --- a/app/assets/javascripts/leaflet.legend.js +++ b/app/assets/javascripts/leaflet.legend.js @@ -1,5 +1,5 @@ L.OSM.legend = function (options) { - const control = L.OSM.sidebarPane(options, "key", "javascripts.key.title", "javascripts.key.title"); + const control = L.OSM.sidebarPane(options, "legend", "javascripts.key.title", "javascripts.key.title"); control.onAddPane = function (map, button, $ui) { $ui diff --git a/app/assets/javascripts/leaflet.sidebar-pane.js b/app/assets/javascripts/leaflet.sidebar-pane.js index acd4b17a1..c0dcb807a 100644 --- a/app/assets/javascripts/leaflet.sidebar-pane.js +++ b/app/assets/javascripts/leaflet.sidebar-pane.js @@ -28,7 +28,7 @@ L.OSM.sidebarPane = function (options, uiClass, buttonTitle, paneTitle) { options.sidebar.addPane($ui); this.loadContent = () => - fetch("/" + uiClass) + fetch("/panes/" + uiClass) .then(r => r.text()) .then(html => { $(html).appendTo($ui); }) .then(this.onContentLoaded); diff --git a/config/routes.rb b/config/routes.rb index ae7b11f51..834c60fa5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -202,7 +202,7 @@ OpenStreetMap::Application.routes.draw do post "/login" => "sessions#create" match "/logout" => "sessions#destroy", :via => [:get, :post] get "/offline" => "site#offline" - resource :legend_pane, :path => "key", :only => :show + resource :legend_pane, :path => "/panes/legend", :only => :show get "/id" => "site#id" resource :feature_query, :path => "query", :only => :show post "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend diff --git a/test/controllers/legend_panes_controller_test.rb b/test/controllers/legend_panes_controller_test.rb index 9794e8412..b96273350 100644 --- a/test/controllers/legend_panes_controller_test.rb +++ b/test/controllers/legend_panes_controller_test.rb @@ -5,7 +5,7 @@ class LegendPanesControllerTest < ActionDispatch::IntegrationTest # test all routes which lead to this controller def test_routes assert_routing( - { :path => "/key", :method => :get }, + { :path => "/panes/legend", :method => :get }, { :controller => "legend_panes", :action => "show" } ) end diff --git a/test/system/site_test.rb b/test/system/site_test.rb index e32c48a5c..09e14440a 100644 --- a/test/system/site_test.rb +++ b/test/system/site_test.rb @@ -20,7 +20,7 @@ class SiteTest < ApplicationSystemTestCase visit "/" assert_no_selector ".tooltip" - button = find ".control-key .control-button" + button = find ".control-legend .control-button" button.hover tooltip = find ".tooltip" tooltip.assert_text "Map Key" @@ -31,7 +31,7 @@ class SiteTest < ApplicationSystemTestCase visit "/#layers=H" # assumes that HOT layer has no map key assert_no_selector ".tooltip" - button = find ".control-key .control-button" + button = find ".control-legend .control-button" button.hover tooltip = find ".tooltip" tooltip.assert_text "Map Key" -- 2.39.5