]> git.openstreetmap.org Git - rails.git/commitdiff
Rename browse controller to feature queries controller
authorAnton Khorev <tony29@yandex.ru>
Wed, 5 Mar 2025 17:12:39 +0000 (20:12 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 5 Mar 2025 17:12:39 +0000 (20:12 +0300)
app/abilities/ability.rb
app/controllers/feature_queries_controller.rb [moved from app/controllers/browse_controller.rb with 68% similarity]
app/views/feature_queries/show.html.erb [moved from app/views/browse/query.html.erb with 100% similarity]
config/locales/en.yml
config/routes.rb
test/controllers/feature_queries_controller_test.rb [moved from test/controllers/browse_controller_test.rb with 65% similarity]

index 7f47b578cb5f9bffb2e8b5805f1a591c8acd2322..bd3ea28bb1e18f151ef593b1c854a4771021f9f0 100644 (file)
@@ -4,7 +4,7 @@ class Ability
   include CanCan::Ability
 
   def initialize(user)
-    can :query, :browse
+    can :read, :feature_query
     can :read, [Node, Way, Relation, OldNode, OldWay, OldRelation]
     can [:show, :create], Note
     can :search, :direction
similarity index 68%
rename from app/controllers/browse_controller.rb
rename to app/controllers/feature_queries_controller.rb
index a3e65a1b7bec4f2352ce11c5e72a144977dd8903..f0f238c7a2eedc78b5f26939f35ede2061825ca4 100644 (file)
@@ -1,13 +1,13 @@
-class BrowseController < ApplicationController
+class FeatureQueriesController < ApplicationController
   layout :map_layout
 
   before_action :authorize_web
   before_action :set_locale
   before_action -> { check_database_readable(:need_api => true) }
   before_action :require_oauth
-  before_action :update_totp, :only => [:query]
+  before_action :update_totp
   around_action :web_timeout
   authorize_resource :class => false
 
-  def query; end
+  def show; end
 end
index b56fb6410c6af3c6460180e2d7921518d247ce7c..8b60b094cbbdf4a5a76ce0a0a6e0cca3de92a655 100644 (file)
@@ -417,7 +417,8 @@ en:
       telephone_link: "Call %{phone_number}"
       colour_preview: "Colour %{colour_value} preview"
       email_link: "Email %{email}"
-    query:
+  feature_queries:
+    show:
       title: "Query Features"
       introduction: "Click on the map to find nearby features."
       nearby: "Nearby features"
index 3f4a12bd782e058360439c44e3c3ac30bdb15c48..8d42db69b4343c673b2ecd4ed70ae8f887fdd383 100644 (file)
@@ -204,7 +204,7 @@ OpenStreetMap::Application.routes.draw do
   get "/offline" => "site#offline"
   get "/key" => "site#key"
   get "/id" => "site#id"
-  get "/query" => "browse#query"
+  resource :feature_query, :path => "query", :only => :show
   post "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend
   match "/user/:display_name/confirm" => "confirmations#confirm", :via => [:get, :post]
   match "/user/confirm" => "confirmations#confirm", :via => [:get, :post]
similarity index 65%
rename from test/controllers/browse_controller_test.rb
rename to test/controllers/feature_queries_controller_test.rb
index 1844dcc6cc253e90d49d38bc57ca600236daa3ef..ad2b5ad4d81bb56e8859b358c47a7c0b1ad7744b 100644 (file)
@@ -6,13 +6,13 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest
   def test_routes
     assert_routing(
       { :path => "/query", :method => :get },
-      { :controller => "browse", :action => "query" }
+      { :controller => "feature_queries", :action => "show" }
     )
   end
 
-  def test_query
-    get query_path
+  def test_show
+    get feature_query_path
     assert_response :success
-    assert_template "browse/query"
+    assert_template "feature_queries/show"
   end
 end