From 0ed7da0a5186eee5c3763d9e5928a464023ed1a3 Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Tue, 17 Jun 2025 04:58:40 +0200 Subject: [PATCH] Rename map key controller to legend pane Switch the terminology from "map key" to "legend pane". The change to the synonym is made for clarity, the inclusion of "pane" helps to clarify the context and purpose of the component. --- app/abilities/ability.rb | 2 +- ...{map_keys_controller.rb => legend_panes_controller.rb} | 2 +- app/views/{map_keys => legend_panes}/show.html.erb | 0 config/locales/en.yml | 2 +- config/routes.rb | 2 +- ...controller_test.rb => legend_panes_controller_test.rb} | 8 ++++---- 6 files changed, 8 insertions(+), 8 deletions(-) rename app/controllers/{map_keys_controller.rb => legend_panes_controller.rb} (92%) rename app/views/{map_keys => legend_panes}/show.html.erb (100%) rename test/controllers/{map_keys_controller_test.rb => legend_panes_controller_test.rb} (56%) diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index 162308287..f68449aa8 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, :map_key] + can :read, [:feature_query, :legend_pane] can :read, [Node, Way, Relation, OldNode, OldWay, OldRelation] can [:show, :create], Note can :read, :directions diff --git a/app/controllers/map_keys_controller.rb b/app/controllers/legend_panes_controller.rb similarity index 92% rename from app/controllers/map_keys_controller.rb rename to app/controllers/legend_panes_controller.rb index c1ce514e1..c00a6a434 100644 --- a/app/controllers/map_keys_controller.rb +++ b/app/controllers/legend_panes_controller.rb @@ -1,4 +1,4 @@ -class MapKeysController < ApplicationController +class LegendPanesController < ApplicationController before_action :authorize_web before_action :set_locale authorize_resource :class => false diff --git a/app/views/map_keys/show.html.erb b/app/views/legend_panes/show.html.erb similarity index 100% rename from app/views/map_keys/show.html.erb rename to app/views/legend_panes/show.html.erb diff --git a/config/locales/en.yml b/config/locales/en.yml index dc3e83b6a..3e505ac9f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2586,7 +2586,7 @@ en: social_links: show: other: Other - map_keys: + legend_panes: show: entries: motorway: "Motorway" diff --git a/config/routes.rb b/config/routes.rb index 0140f2b64..ae7b11f51 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 :map_key, :path => "key", :only => :show + resource :legend_pane, :path => "key", :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/map_keys_controller_test.rb b/test/controllers/legend_panes_controller_test.rb similarity index 56% rename from test/controllers/map_keys_controller_test.rb rename to test/controllers/legend_panes_controller_test.rb index fdf8ee1f7..9794e8412 100644 --- a/test/controllers/map_keys_controller_test.rb +++ b/test/controllers/legend_panes_controller_test.rb @@ -1,20 +1,20 @@ require "test_helper" -class MapKeysControllerTest < ActionDispatch::IntegrationTest +class LegendPanesControllerTest < ActionDispatch::IntegrationTest ## # test all routes which lead to this controller def test_routes assert_routing( { :path => "/key", :method => :get }, - { :controller => "map_keys", :action => "show" } + { :controller => "legend_panes", :action => "show" } ) end def test_show - get map_key_path, :xhr => true + get legend_pane_path, :xhr => true assert_response :success - assert_template "map_keys/show" + assert_template "legend_panes/show" assert_template :layout => false end end -- 2.39.5